# Revision history [back]

### How to set a ROI with arbitrary shape?

Hello, the code is here

cv::Mat src = cv::imread("1.bmp", CV_LOAD_IMAGE_UNCHANGED);
cv::Mat roi;
src.copyTo(roi, mask); // get the roi


This is 1.bmp

This is roi

If I excute roi = roi + 10, the black parts of roi will also add 10, it's not what I want. How to get a roi without the black parts?

Thanks!

### How to set a ROI with arbitrary shape?

Hello, the code is here

cv::Mat src = cv::imread("1.bmp", CV_LOAD_IMAGE_UNCHANGED);

If I excute roi = roi + 10, the black parts of roi will also add 10, it's not what I want. How to get a roi without the black parts?