当我使用opencv检测带圆角的矩形时,我需要解决一个问题。基本上我使用的是相同的代码示例 squares.c:
cvFindContours( gray, storage, &contours, sizeof(CvContour), CV_RETR_LIST, CV_CHAIN_APPROX_SIMPLE );
while( contours )
{
double area=fabs(cvContourArea(contours, CV_WHOLE_SEQ));
if(area < minimum_area || area > maximum_area) {
contours = contours->h_next;
continue;
}
result = cvApproxPoly( contours, sizeof(CvContour), storage,
CV_POLY_APPROX_DP, cvContourPerimeter(contours)*0.05, 0 );
if( result->total == 4 &&
fabs(cvContourArea(result,CV_WHOLE_SEQ)) > 1000 &&
cvCheckContourConvexity(result) )
{
使用此代码,我通常可以检测到图像,但我需要调整图像的透视,为此我需要检测图像的角,如何做到这一点并且图像具有圆角?问题的发生是因为我不需要在点之间检测到点,例如,我创建了下图,其中黑线代表现有代码检测到的点,而蓝点是我需要的点?
谢谢你的帮助。