ranger
ranger

Reputation: 496

Opencv: How to compute mirror of Rect vector

I am working on a video processing project and need to find an ROI from the mirror of the source image.

The ROI coordinates are with respect to the mirror image, and I need to map it to the original source image. Is there any built in functions in opencv for this?

ROI is a rectangle and by mirror image I mean flipping the image with respect to the Y-axis.

Upvotes: 1

Views: 1189

Answers (2)

ranger
ranger

Reputation: 496

This works for me:

cv::Rect r;

for(int i=0;i<rectg.size();i++)
{
     r=rectg[i];
     r.x=rotated_img.cols-r.x-r.width;
     rectg[i]=r;
}

Upvotes: 1

Nikson Kanti Paul
Nikson Kanti Paul

Reputation: 3440

cvSetImageROI is for setting the ROI region. here the rect is your desire region of interest. cvGetImageROI is return the selected ROI rectangle.

void cvSetImageROI(IplImage* image, CvRect rect) 

Upvotes: 0

Related Questions