I have extracted contours with cv2.findContours
from a binary mask which I created using a segmentation algorithm. Each contour corresponds to an object in the image that I want to save to a save to a separate image file.
How can I get a rectangular region of interest (ROI) from a set of points (e.g. contour) and save that ROI to a separate image?
I use Python, but if you can post the answer for C++, that's also appreciated.