Emgu CV 无法从给定路径创建图像
Emgu CV cannot create an image from given path
当我从给定路径加载图像时:
Image<Bgr, byte> source = new Image<Bgr, byte>(absoluteImagePath);
绝对路径是:
D:\Users\Oijafaosfasdf\Source\Workspaces\SomeProject\SomeProjectV3\SomeProject.UI\bin\Debug6260785130864402.png
它抛出奇怪的异常:
第一次:
在不终止程序的情况下尝试创建图像的所有其他时间:
--- Start of inner exception stack trace ---
The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.ArgumentException:
The path is not of a legal form. at
System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32
maxPathLength, Boolean expandShortPaths) at
System.IO.Path.GetFullPathInternal(String path) at
System.IO.FileInfo.Init(String fileName, Boolean checkHost) at
System.IO.FileInfo..ctor(String fileName) at
Emgu.CV.CvInvoke.LoadUnmanagedModules(String loadDirectory, String[]
unmanagedModules) at
Emgu.CV.CvInvoke.DefaultLoadUnmanagedModules(String[] modules) at
Emgu.CV.CvInvoke..cctor()
--- End of inner exception stack trace ---
这不是重复这个 -> 问题,因为我提供了绝对路径。
我已经检查过文件格式是否有效并且文件存在于目录中..
那么,可能会出什么问题呢?
注意:我正在使用 Nuget 包管理器安装 Emgu CV (v3.1.0.1)。
试试这个:
Image<bgr, byte> source = new Image<bgr, byte>("D://Users//Oijafaosfasdf//Source//Workspaces//SomeProject//SomeProjectV3//SomeProject.UI//bin//Debug//636260785130864402.png");
或者尝试加载任何其他图像,如果它有效,则可能是您尝试加载的图像已损坏 headers。
盯着同样的错误信息看了几个小时后,我意识到问题出在 dll 上,找不到它们。由于我已经安装了 Costura.Fody 将所有 dll 合并到可执行文件中的软件包,这就是为什么 Emgu CV 根本没用..感谢所有帮助过的人!
当我从给定路径加载图像时:
Image<Bgr, byte> source = new Image<Bgr, byte>(absoluteImagePath);
绝对路径是:
D:\Users\Oijafaosfasdf\Source\Workspaces\SomeProject\SomeProjectV3\SomeProject.UI\bin\Debug6260785130864402.png
它抛出奇怪的异常:
第一次:
在不终止程序的情况下尝试创建图像的所有其他时间:
--- Start of inner exception stack trace ---
The type initializer for 'Emgu.CV.CvInvoke' threw an exception. ---> System.ArgumentException: The path is not of a legal form. at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths) at System.IO.Path.GetFullPathInternal(String path) at System.IO.FileInfo.Init(String fileName, Boolean checkHost) at System.IO.FileInfo..ctor(String fileName) at Emgu.CV.CvInvoke.LoadUnmanagedModules(String loadDirectory, String[] unmanagedModules) at Emgu.CV.CvInvoke.DefaultLoadUnmanagedModules(String[] modules) at Emgu.CV.CvInvoke..cctor()
--- End of inner exception stack trace ---
这不是重复这个 ->
注意:我正在使用 Nuget 包管理器安装 Emgu CV (v3.1.0.1)。
试试这个:
Image<bgr, byte> source = new Image<bgr, byte>("D://Users//Oijafaosfasdf//Source//Workspaces//SomeProject//SomeProjectV3//SomeProject.UI//bin//Debug//636260785130864402.png");
或者尝试加载任何其他图像,如果它有效,则可能是您尝试加载的图像已损坏 headers。
盯着同样的错误信息看了几个小时后,我意识到问题出在 dll 上,找不到它们。由于我已经安装了 Costura.Fody 将所有 dll 合并到可执行文件中的软件包,这就是为什么 Emgu CV 根本没用..感谢所有帮助过的人!