求轮廓最大内切圆


void FindInnerCircleInContour(vector contour,Point ¢er,int &radius)
{
	Rect r = boundingRect(contour);
	int nL = r.x, nR = r.br().x; //轮廓左右边界
	int nT = r.y, nB = r.br().y; //轮廓上下边界

	int dist = 0;
	int maxdist = 0;

	for (int i = nL; imaxdist)
			{
                                //求最大距离,只有轮廓最中心的点才距离最大
				maxdist = dist;
				center = Point(i, j);
			}
		}
	}
	radius = maxdist;  //圆半径
}

 

 

 

你可能感兴趣的:(图像处理)