将图片的坐标写入数组中,并把坐标值由小到大排列好
int temp.x=0,temp.y=0;
for( ; contour; contour = contour->h_next )
{
CvRect rect=cvBoundingRect(contour,1);
CvPoint pt1=cvPoint(rect.x,rect.y),pt2=cvPoint(rect.x+rect.width, rect.y+rect.height);
cvRectangle(dst,pt1,pt2,CV_RGB(255,0,0),1,CV_AA,0);
cvLine(dst,pt1,pt2,CV_RGB(0,255,0),1,CV_AA,0);
pt1=cvPoint(rect.x,rect.y+rect.height),
pt2=cvPoint(rect.x+rect.width,rect.y);
cvLine(dst,pt1,pt2,CV_RGB(0,255,0),1,CV_AA,0);
temp.x=rect.x+ rect.width/2;
temp.y=rect.y+ rect.height/2;
}
将temp.x , temp.y写入到数组中并排好序(从小到大)