# Revision history [back]

The ROI of a mat is not needed to be always a rectangle, but cv::Mat is always a matrix, or a rectangle image, so you cannot have a round image, but you may have a circle on a black background that contains the information that you want. For having this, you have to use a maks:

cv::Mat image = cv::imread("img.jpg");

So, the ROI may be any shape, by using a mask. But if you are refering at the ROI as a submatrix, then you must have a rectangle for defining it (you can use the rectangle that englobes the circle: cv::Rect roi(circleCenter.x - radius, circleCenter.y - radius, 2*radius, 2*radius); but do not forget to do an AND operation, for being sure that it does not get out of the image boundaries: roi = roi & cv::Rect(0, 0, image.cols, image.rows)).