c - Why does FindContours function in opencv find two contours instead of one in an image as below? -
Input image - Output image with convex solution of the prepared content -
Will also be greatly appreciated for getting a contour help?
Moving the image to as a contour Output: cvFindContours Image being processed before is being processed. >
IplImage * src = cvLoadImage (argv [1], CV_LOAD_IMAGE_GRAYSCALE); IplImage * cc_img = cvCreateImage (cvGetSize (src), src- & gt; Depth, 3); CvSetZero (cc_img); CvScalar (ext_color); CvMemStorage * mem; Mem = cvCreateMemStorage (0); CVSeq * pattern = 0; // The edges returned by the Kinnies can be small gaps between them, which can cause some problems during detection of contour. The easiest way to solve this problem is to "stretch" the image. CvCanny (src, src, 10, 50, 3); CvShowImage ("tutorial", src); CvWaitKey (0); Int n = cvFindContours (src, mem, & contours, sizeof (cvcontour), cv_RETR_CCOMP, CV_CHAIN_APPROX_SIMPLE, cvPoint (0,0)); CVSeq * ptr = 0; (Ptr = contours; ptr! = Null; ptr = ptr-> h_next) {ext_color = CV_RGB (rand ()) and 255, rand () and 255, rand () and 255); // Randomly assign different settings to cvDrawContours (cc_img, ptr, ext_color, cv_rgb (0,0,0), -1, cv_fild, 8, cvpint (0,0)); } CvNamedWindow ("Tutorial"); CvShowImage ("tutorial", cc_img); // cvSaveImage ("out.png", cc_img); CvWaitKey (0);
Comments
Post a Comment