Object detection using emgu cv CvInvoke.cvHoughCircles
I want to detect objects using cvHoughCircles
method in visual c#.If anyone knows how to do this please help me.
Edit Details:
I searched in the Internet there is examples using gray.HoughCircles
method.
Image<Bgr, Byte> image = capture.QueryFrame();
MCvScalar hsv_min = new MCvScalar(150, 84, 130, 0);
MCvScalar hsv_max = new MCvScalar(358, 256, 255, 0);
IntPtr hsv_frame = CvInvoke.cvCreateImage(new System.Drawing.Size(640, 480),IPL_DEPTH.IPL_DEPTH_8U, 3);
IntPtr thresholded = CvInvoke.cvCreateImage(new System.Drawing.Size(640, 480), IPL_DEPTH.IPL_DEPTH_8U, 1);
CvInvoke.cvCvtColor(image, hsv_frame, COLOR_CONVERSION.CV_BGR2HSV);
CvInvoke.cvInRangeS(hsv_frame, hsv_min, hsv_max, thresholded);
IntPtr storage = CvInvoke.cvCreateMemStorage(0);
CvInvoke.cvSmooth(thresholded, thresholded, SMOOTH_TYPE.CV_GAUSSIAN, 9, 9, 0, 0);
IntPtr circles= CvInvoke.cvHoughCircles(thresholded, storage,HOUGH_TYPE.CV_HOUGH_GRADIENT , 2, 4, 100, 50, 10, 400);
In the following link there is code.But it is开发者_如何学编程 in pythen.So what I'm doing is trying to convert it into visual c#.
http://www.lirtex.com/robotics/fast-object-tracking-robot-computer-vision/#comment-847
I want to take all detected circles in to for loop and then draw circle to corresponding objects as in pythen code.
I tried to use foreach loop but there is error,
foreach statement cannot operate on variables of type 'System.IntPtr' because 'System.IntPtr' does not contain a public definition for 'GetEnumerator'.
Is there any method to avoid this error.
Did you try this tutorial?
Shape (Triangle, Rectangle, Circle, Line) Detection in CSharp
This contains good tutorial which may be help you.
精彩评论