我创建了imageHolder的类:
I created imageHolder class:
public class ImageHolder : Image<Bgr, Byte>
{
private String imagePath;
public ImageHolder(String path):base(path)
{
this.imagePath = path;
}
public String imgPathProperty
{
get
{ return imagePath; }
set
{ imagePath = value; }
}
}
我创建类的实例,并初始化它,像这样:
I create instance of the class and initialize it,like this:
private ImageHolder originalImageHolder;
originalImageHolder = new ImageHolder(openFileDialog.FileName);
在运行时我得到这个异常:
In runtime i get this exception:
的类型初始Emgu.CV.CvInvoke'引发了异常。
下面是解决方案资源管理器窗口:
Here is Solution Explorer window:
任何想法,为什么我得到这个例外,我该如何解决?
Any idea why i get this exception and how can i fix it?
感谢你在前进。
的TypeInitializationException (您看到的除外)被抛出时静态构造函数抛出一个异常,或当你试图访问一个类,其中静态构造函数抛出了一个异常 - 它的InnerException属性是包含已actualy抛出的异常的细节性 - 这就是你需要调查的异常
The TypeInitializationException (the exception that you are seeing) is thrown whenever a static constructor throws an exception, or whenever you attempt to access a class where the static constructor threw an exception - its InnerException property is the property that contains the detail of the exception that was actualy thrown - this is the exception that you need to investigate.
在您的屏幕截图这种情况下,这个问题似乎是,该DLLopencv_core240.dll无法被发现。这可能是由于多种原因
In this case from your screenshot the problem appears to be that the DLL "opencv_core240.dll" could not be found. This could be for a number of reasons
在该DLL找不到 在其中一个DLL的依赖找不到 在该DLL是不正确的图像格式(32位而不是64位)我建议你看一看这个问题以查看是否有任何的建议,在那里帮助你。
I'd suggest that you take a look at this question to see if any of the suggestions on there help you.