Confuse with the ROI rect parameter
Hi Everyone, Im confused here... I wanted to select the ROI half of the bottom or the image 1024x 576.
The parameter for rect (x,y,h,w) ... OK h and w and I understand. But what about x and y?? int main(int argc, char** argv) { Rect rectangle (50,30,100,512); image=imread("c:\a.jpg",1); // fill it however you want to Mat im_roi = image(rectangle); imshow("ROI",im_roi); }
If I had processed the ROI after the correct process, how can I draw back the result and put it back on the original image? Do I need to redo the rect roi again for both?
Thanks a lot
Zamani
ROI is the region of interest. It starts at the point(x, y) (top left corner of the Rect) and the w and h you know. Ex: image(1024x576), roi(50, 60, 70, 80); image(roi) will contain the part of the image from pixel at (50, 60) and goes until the pixel (50+70, 60+80). Just draw it on a paper, like a coordinate graph, only that (0, 0) is top-left.
Hey thanks!! I had try to get the half of the image with this code
Rect rectangle (0,image.rows/2,image.cols,image.rows/2); and it perfectly ROI the part. So if I had processed the ROI after the correct process, how can I draw back the result and put it back on the original image? Do I need to redo the rect roi again for both?
Due to the ROI the final result for processing had been shifted up when combining with the original image... I had draw the line by using the Line function on a Mat array and show put it on the original image. The lines now are shifted due to the ROI. I look back at the MAT function and not sure by constructing the MAT with the new dimension would help.. If you have any I would absolutely appreciate it..