Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

I have found a way to solve this problem.

When you have got the mask, just keep it in the memory. After your operation for the image, do xx.copyTo(image, mask) again. Then the operation of ROI region will remain in the result, and the other region will be zero.

Note for copyTo():

src.copyTo(dst, mask) // src and dst should be different, and dst should be empty.