I'd like to use a ROI to copy a found polygon in an image, into a new image. I'd like this polygon to fit exactly in the new image. So far I used ROI, but I noticed that the angle is not taken into account, which give me bad result as soon as I rotate the object I whish to detect. I need this object alone for further analysis...
Here is what I do:
while(/****/)
{
CvSeq* approximatedContour = cvApproxPoly(currentContour,
sizeof(CvContour),
0,
CV_POLY_APPROX_DP,
8);
etiquetteBox = cvMinAreaRect2(approximatedContour);
CvSize2D32f sizeEtiquette = etiquetteBox.size;
if(/****/)
{
CvPoint2D32f boxPoints[4];
cvBoxPoints(etiquetteBox, boxPoints);
cvSetImageROI(thresImg,cvRect((int)boxPoints[1].x, (int)boxPoints[1].y,
(int)sizeEtiquette.width,(int)sizeEtiquette.height));
cvResize(thresImg,thresImgResized);
/*****/
}
Does anyone know how to integrate angle into ROI? Is it possible to do otherwise?
Thanks!