Click here to Skip to main content
15,886,025 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi, i am trying to detect eyes coordinates with the aim of find the center point of the face. The problem is that I can´t really understand how the MCvAvgComp[][] works so, what I do generates an IndexOutofRangeException. The code is this:

XML
Rectangle rectangulo = new Rectangle(Izq, Superior, Ancho, Alto);
Image<Bgr, byte> subImage = ImageFrame.GetSubRect(rectangulo);

// eyes detection
ImageFrame.ROI = face.rect;
MCvAvgComp[][] eyesDetected = subImage.DetectHaarCascade(haareyes, 1.1, 10, Emgu.CV.CvEnum.HAAR_DETECTION_TYPE.DO_CANNY_PRUNING, new Size(20, 20));
subImage.ROI = Rectangle.Empty;

Int32 eyesCenterX = (eyesDetected[0][1].rect.X + (eyesDetected[0][1].rect.Width / 2)) - (eyesDetected[0][0].rect.X + (eyesDetected[0][0].rect.Width / 2)) / 2;


What I have understood is that every McvAvgComp struct stores a rect (area) where the object detected is(an eye). The array, I think, stores couples of MCvAvgComp structs (left and right eye) and the jagged array stores all possible pairs of eyes detected. Is that? How can I access to the pair of rects left an right?

Thank you.
Dumar
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900