面部识别emgu.cv.dll异常对象引用未设置为对象的实例 [英] Face recognition emgu.cv.dll exception object reference not set to an instance of an object
问题描述
我希望使用Emgu.CV库识别面孔我从数据库中选择了经过训练的面孔并将它们存储在图像列表以及标签中
我的问题是甚至当我运行该程序时它向我显示此错误
i want recognize faces using Emgu.CV library i selected the trained faces from the database and store them in image list as well as the labels
my problem is that when even i run the program it show me this error
An unhandled exception of type 'System.NullReferenceException' occurred in Emgu.CV.dll
Additional information: Object reference not set to an instance of an object.
请问这个问题的原因是什么以及如何我可以解决吗?
我尝试过的事情:
i有试过这段代码
please what is the cause of this problem and how can i solve if?
What I have tried:
i have tried this code
Dim trainingImages() As Image(Of Gray, Byte) = New Image(Of Gray, Byte)((5) - 1) {}
trainingImages(0) = New Image(Of Gray, Byte)(PictureBox1.Image)
Dim labels() As String = New String() {"Brad"}
Dim termCrit As New MCvTermCriteria(30, 0.001)
recognizer = New EigenObjectRecognizer(trainingImages.ToArray, labels.ToArray, 1000, termCrit)
Dim testImage As Image(Of Gray, Byte) = New Image(Of Gray, Byte)(imgFrame.Bitmap)
Dim label As String = recognizer.Recognize(testImage).Label
Console.Write(label)
我将非常感谢您的回复。 thnx
i'll appreciate your response. thnx
推荐答案
您应该学习尽快使用调试器。而不是猜测你的代码在做什么,现在是时候看到你的代码执行并确保它完成你期望的。
调试器允许你跟踪执行逐行检查变量,你会看到有一点它会停止你所期望的。
在Visual Studio 2010中掌握调试 - 初学者指南 [ ^ ]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html [ ^ ]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html [ ^ ]
You should learn to use the debugger as soon as possible. Rather than guessing what your code is doing, It is time to see your code executing and ensuring that it does what you expect.
The debugger allow you to follow the execution line by line, inspect variables and you will see that there is a point where it stop doing what you expect.
Mastering Debugging in Visual Studio 2010 - A Beginner's Guide[^]
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/jdb.html[^]
https://www.jetbrains.com/idea/help/debugging-your-first-java-application.html[^]
面部识别emgu.cv.dll异常对象引用未设置为对象的实例
Face recognition emgu.cv.dll exception object reference not set to an instance of an object
变量未初始化或者失败使变量收到NULL而不是预期的对象。
调试器将帮助您找到失败的位置。
Either a variable is not initialized or a fail made that a variable received NULL instead of the expected object.
The debugger will help you to to find where is the fail.
这篇关于面部识别emgu.cv.dll异常对象引用未设置为对象的实例的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!