Question

Please guys help me for resolving the issue in the following statement:

MCvAvgComp[][] Detector = IMAGEgray.DetectHaarCascade(face, 2.1, 10, 
 Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(20, 20));"

After debugging the solution The compiler show me the following Error:

Object reference not set to an instance of an object.

Was it helpful?

Solution

Because you're dealing with Haar Cascade logic, IMAGEGray looks to be the gray scale image of type

Image<Gray, byte> IMAGEGray;

Ensure that it is correctly initialized OR converted rightly from a frame. Basically check that it is not null.

and in this line:

IMAGEgray.DetectHaarCascade(face, 2.1, 10, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(20, 20));

face is a variable initialized something like:

var face = new HaarCascade("haarcascade_some_tree.xml");

Ensure that face is not null.

If both the variables are not null, then the DetectHaarCascade method probably expects some fields in the face object to be non-null and it is finding null.

Ensure if the face object fields are non-null. (some key ones once the variable is initialized)

OTHER TIPS

Is IMAGEgray a static class? If it isn't then it's probably a null field and the source of your issue.

Otherwise, it sounds like a bug in the method you're calling.

you need to add .xml file in your .../bin/Debug. Then type in your ProcesFrame Method: //haar is HaarCascade haar = new HaarCascade("haarcascade_frontalface_default.xml");

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top