I am new on EmguCv and kinect v2 development.
I am trying to draw the contour of the hand that was detected on a blank Gray Image. And I am encountering this Exception that always occurs after the line of code:
CvInvoke.DrawContours(image, temp, -1, new MCvScalar(255, 0, 0), thickness);
Here is my function for drawing the contour:
private void drawOnEachHand(Hand whichHand, Image<Gray, byte> image) {
int thickness = 2;
//Console.WriteLine("Check2 " + (whichHand == null));
if (whichHand != null)
{
VectorOfPoint temp = new VectorOfPoint(whichHand.ContourDepth.Count);
List<Point> arrTemp = new List<Point>();
for (int intCounter = 0; intCounter < whichHand.ContourDepth.Count; intCounter++)
{
int X = Convert.ToInt32(MathExtensions.ToPoint(whichHand.ContourDepth[intCounter]).X);
int Y = Convert.ToInt32(MathExtensions.ToPoint(whichHand.ContourDepth[intCounter]).Y);
arrTemp.Add(new Point(X, Y));
}
temp.Push(arrTemp.ToArray());
CvInvoke.DrawContours(image, temp, -1, new MCvScalar(255, 0, 0), thickness);
Console.WriteLine(image.Cols);
}
}
This is the exception message:
Exception thrown: 'Emgu.CV.Util.CvException' in Emgu.CV.World.dll<br>
An unhandled exception of type 'Emgu.CV.Util.CvException' occurred in Emgu.CV.World.dll<br>
OpenCV: i < 0
I am using Visual Studio 2017, Emgu Cv 3.x and I install it using the nugget. I can't figure out what's the meaning of the exception message.