#include <iostream>
static void help(char** argv)
{
cout << "\n此示例程序演示了 convexHull() 函数的用法\n"
<< "调用:\n"
<< argv[0] << endl;
}
int main(
int argc,
char** argv )
{
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++ )
circle(img, points[i], 3,
Scalar(0, 0, 255), FILLED, LINE_AA);
if( key == 27 || key == 'q' || key == 'Q' )
break;
}
return 0;
}
如果数组没有元素,则返回 true。
int64_t int64
_Tp y
点的 y 坐标
定义 types.hpp:202
_Tp x
点的 x 坐标
定义 types.hpp:201
随机数生成器。
Definition core.hpp:2879
int uniform(int a, int b)
从 [a,b) 范围内返回均匀分布的整数随机数
RNG & theRNG()
返回默认的随机数生成器。
@ circle
定义 gr_skig.hpp:62
void imshow(const String &winname, InputArray mat)
在指定窗口中显示图像。
int waitKey(int delay=0)
等待按键按下。
void polylines(InputOutputArray img, InputArrayOfArrays pts, bool isClosed, const Scalar &color, int thickness=1, int lineType=LINE_8, int shift=0)
绘制多条多边形曲线。
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[])
定义 highgui_qt.cpp:3