Wednesday, October 10, 2012

To crop a selected area from a image usign emgucv, C#

Hello World,

To crop a selected area from a image usign emgucv, the C# wrapper for openCV,

Contour<Point> currentContour = biggestContour.ApproxPoly(biggestContour.Perimeter * 0.0025, storage);
currentFrame.Draw(currentContour, new Bgr(Color.BlueViolet), 2);

box = biggestContour.GetMinAreaRect();
PointF[] points = box.GetVertices();
handRect = box.MinAreaRect();

currentFrame.ROI = hand.rect;
currentFrame = currentFrame.Copy();
CvInvoke.cvResetImageROI(currentFrame);
pictureBox1.Image = currentFrame.ToBitmap();



Hope this is helpful to those who get stuck in the middle of image pre-processing as I got myself into.

2 comments: