我想在 Azure Function V3 中使用 EmguCv 版本 4.2
我创建了一个 Azure Function v3(.Net Core) 应用程序
从 Nuget 安装了 Emgu.Cv 版本 4.2.0.3636
也从 Nuget 安装了 Emgu.CV.Runtime.windows 版本 4.2.0.3636
[FunctionName("Function1")]
public static async Task<IActionResult> Run(
[HttpTrigger(AuthorizationLevel.Function, "get", "post", Route = null)] HttpRequest req,
ILogger log)
{
log.LogInformation("C# HTTP trigger function processed a request.");
try
{
SetPathOfEmgu();
var image = new Image<Bgr, byte>(256, 256);
}
catch (Exception ee)
{
return (ActionResult)new BadRequestObjectResult(ee.Message);
throw;
}
return (ActionResult)new OkObjectResult($"All is well");
}
public static void SetPathOfEmgu()
{
string pathValue = System.Environment.GetEnvironmentVariable("PATH");
string emguPath = @"D:\home\site\wwwroot\x64";
var paths = pathValue.Split(';').Where(o => o != "").ToList();
paths.Add(emguPath);
pathValue = string.Join(";", paths.Distinct().ToArray()) + ";";
System.Environment.SetEnvironmentVariable("PATH", pathValue);
}
在调试中运行我得到:“一切都很好”
在 Azure 上运行时,我得到:“无法加载 DLL 'cvextern' 或其依赖项之一:找不到指定的模块。(0x8007007E)”
在“var image = new Image(256, 256);”行
问题:如何从 Azure Function V3 运行 Emgucv?
@斯图尔德:
来自:Emgu 42 Function V3.deps.json
{
"runtimeTarget": {
"name": ".NETCoreApp,Version=v3.0",
"signature": ""
},
"compilationOptions": {},
"targets": {
".NETCoreApp,Version=v3.0": {
"Emgu 42 Function V3/1.0.0": {
"dependencies": {
"Emgu.CV": "4.2.0.3636",
"Emgu.CV.runtime.windows": "4.2.0.3636",
"Microsoft.NET.Sdk.Functions": "3.0.1"
},
"runtime": {
"Emgu 42 Function V3.dll": {}
}
},
"Emgu.CV/4.2.0.3636": {
"runtime": {
"lib/netstandard2.0/Emgu.CV.World.NetStandard.dll": {
"assemblyVersion": "1.0.0.0",
"fileVersion": "1.0.0.0"
}
}
},
"Emgu.CV.runtime.windows/4.2.0.3636": {
"dependencies": {
"Emgu.CV": "4.2.0.3636"
}
},