#include <iostream>
static void help()
{
cout << "This program demonstrates finding the minimum enclosing box, triangle or circle of a set\n"
<< "of points using functions: minAreaRect() minEnclosingTriangle() minEnclosingCircle().\n"
<< "Random points are generated and then enclosed.\n\n"
<< "Press ESC, 'q' or 'Q' to exit and any other key to regenerate the set of points.\n\n"
<< "Call:\n"
<< "./minarea\n"
<<
"Using OpenCV v" <<
CV_VERSION <<
"\n" << endl;
}
int main( int , char** )
{
help();
for(;;)
{
vector<Point> points;
for( i = 0; i < count; i++ )
{
pt.
x = rng.
uniform(img.cols/4, img.cols*3/4);
pt.
y = rng.
uniform(img.rows/4, img.rows*3/4);
points.push_back(pt);
}
float radius = 0;
for( i = 0; i < count; i++ )
for( i = 0; i < 4; i++ )
for( i = 0; i < 3; i++ )
imshow(
"Rectangle, triangle & circle", img );
if( key == 27 || key == 'q' || key == 'Q' )
break;
}
return 0;
}