我无法找到如何使用OpenCV计算凸包区域的实例.我看到一个使用cvApproxPoly和cvContourArea的示例,但我无法使其工作.我有以下代码.
IplImage* img = cvCreateImage( cvSize( 500, 500 ), 8, 3 );
int i, count = rand()%100 + 1;
CvPoint pt0;
CvPoint* points = (CvPoint*)malloc( count * sizeof(points[0]));
int* hull = (int*)malloc( count * sizeof(hull[0]));
CvMat point_mat = cvMat( 1, count, CV_32SC2, points );
CvMat hull_mat = cvMat( 1, count, CV_32SC1, hull );
for( i = 0; i < count; i++ )
{
pt0.x = rand() % (img->width/2) + img->width/4;
pt0.y = rand() % (img->height/2) + img->height/4;
points[i] = pt0; …Run Code Online (Sandbox Code Playgroud) 我编写了提取图像中显示的点的算法。它们形成凸形,我知道它们的顺序。如何从这些点提取角(前3个和后3个)?我正在使用opencv。
