#include <iostream>
static void help(char** argv)
{
cout << "\nThis sample program demonstrates the use of the convexHull() function\n"
<< "Call:\n"
<< argv[0] << endl;
}
int main(
int argc,
char** argv )
{
CommandLineParser parser(argc, argv, "{help h||}");
if (parser.has("help"))
{
help(argv);
return 0;
}
for(;;)
{
int i, count = (unsigned)rng%100 + 1;
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);
}
vector<Point> hull;
img = Scalar::all(0);
for( i = 0; i < count; i++ )
if( key == 27 || key == 'q' || key == 'Q' )
break;
}
return 0;
}
_Tp x
x coordinate of the point
Definition: modules/core/include/opencv2/core/types.hpp:201
RNG & theRNG()
Returns the default random number generator.
Point2i Point
Definition: modules/core/include/opencv2/core/types.hpp:209
Scalar_< double > Scalar
Definition: modules/core/include/opencv2/core/types.hpp:709
#define CV_8UC3
Definition: core/include/opencv2/core/hal/interface.h:90
@ circle
Definition: gr_skig.hpp:62
void imshow(const String &winname, InputArray mat)
Displays an image in the specified window.
int waitKey(int delay=0)
Waits for a pressed key.
void polylines(InputOutputArray img, InputArrayOfArrays pts, bool isClosed, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
Draws several polygonal curves.
@ LINE_AA
antialiased line
Definition: imgproc/include/opencv2/imgproc.hpp:894
@ FILLED
Definition: imgproc/include/opencv2/imgproc.hpp:891
void convexHull(InputArray points, OutputArray hull, bool clockwise=false, bool returnPoints=true)
Finds the convex hull of a point set.
int main(int argc, char *argv[])
Definition: highgui_qt.cpp:3
Definition: core/include/opencv2/core.hpp:107