|
|
|
@ -1,5 +1,16 @@ |
|
|
|
|
#include <opencv2/imgproc/imgproc.hpp> |
|
|
|
|
#include <opencv2/highgui/highgui.hpp> |
|
|
|
|
#include <stdio.h> |
|
|
|
|
void help() |
|
|
|
|
{ |
|
|
|
|
printf("\nThis program creates an image to demonstrate the use of the \"c\" contour\n" |
|
|
|
|
"functions: cvFindContours() and cvApproxPoly() along with the storage\n" |
|
|
|
|
"functions cvCreateMemStorage() and cvDrawContours().\n" |
|
|
|
|
"It also shows the use of a trackbar to control contour retrieval.\n" |
|
|
|
|
"\n" |
|
|
|
|
"Call:\n" |
|
|
|
|
"./contours\n"); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
#define w 500 |
|
|
|
|
int levels = 3; |
|
|
|
@ -18,12 +29,14 @@ void on_trackbar(int pos) |
|
|
|
|
cvReleaseImage( &cnt_img ); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int main( int argc, char** argv ) |
|
|
|
|
{ |
|
|
|
|
int i, j; |
|
|
|
|
CvMemStorage* storage = cvCreateMemStorage(0); |
|
|
|
|
IplImage* img = cvCreateImage( cvSize(w,w), 8, 1 ); |
|
|
|
|
|
|
|
|
|
help(); |
|
|
|
|
cvZero( img ); |
|
|
|
|
|
|
|
|
|
for( i=0; i < 6; i++ ) |
|
|
|
|