1 | initial version |
Solution to my problem :
//define your mask image
cv::Mat mask22 = cv::Mat::zeros(imv.size(), imv.type());
mask22 = cv::Scalar(255, 255, 255);
//Define your destination image
cv::Mat dstImage = cv::Mat::ones(imv.size(), imv.type());
rectangle(mask22, bounding_rect, cv::Scalar(0, 0, 0), -1);
imshow("msk", mask22);
//Now you can copy your source image to destination image with masking
imv.copyTo(dstImage, mask22);
imshow("fond en cours", dstImage);