#include <math.h>
#include <iostream>
using namespace cv;
using namespace std;
static void help()
{
cout
<< "\nThis program illustrates the use of findContours and drawContours\n"
<< "The original image is put up along with the image of drawn contours\n"
<< "Usage:\n"
<< "./contours2\n"
<< "\nA trackbar is put up which controls the contour level from -3 to 3\n"
<< endl;
}
const int w = 500;
int levels = 3;
vector<vector<Point> > contours;
vector<Vec4i> hierarchy;
static void on_trackbar(int, void*)
{
int _levels = levels - 3;
}
int main( int argc, char** argv)
{
if (parser.has("help"))
{
help();
return 0;
}
for( int i = 0; i < 6; i++ )
{
int dx = (i%2)*250 - 30;
int dy = (i/2)*150;
if( i == 0 )
{
for( int j = 0; j <= 10; j++ )
{
double angle = (j+5)*
CV_PI/21;
}
}
ellipse( img,
Point(dx+150, dy+100),
Size(100,70), 0, 0, 360, white, -1, 8, 0 );
ellipse( img,
Point(dx+115, dy+70),
Size(30,20), 0, 0, 360, black, -1, 8, 0 );
ellipse( img,
Point(dx+185, dy+70),
Size(30,20), 0, 0, 360, black, -1, 8, 0 );
ellipse( img,
Point(dx+115, dy+70),
Size(15,15), 0, 0, 360, white, -1, 8, 0 );
ellipse( img,
Point(dx+185, dy+70),
Size(15,15), 0, 0, 360, white, -1, 8, 0 );
ellipse( img,
Point(dx+115, dy+70),
Size(5,5), 0, 0, 360, black, -1, 8, 0 );
ellipse( img,
Point(dx+185, dy+70),
Size(5,5), 0, 0, 360, black, -1, 8, 0 );
ellipse( img,
Point(dx+150, dy+100),
Size(10,5), 0, 0, 360, black, -1, 8, 0 );
ellipse( img,
Point(dx+150, dy+150),
Size(40,10), 0, 0, 360, black, -1, 8, 0 );
ellipse( img,
Point(dx+27, dy+100),
Size(20,35), 0, 0, 360, white, -1, 8, 0 );
ellipse( img,
Point(dx+273, dy+100),
Size(20,35), 0, 0, 360, white, -1, 8, 0 );
}
vector<vector<Point> > contours0;
contours.resize(contours0.size());
for( size_t k = 0; k < contours0.size(); k++ )
on_trackbar(0,0);
return 0;
}