Hello.
I've got a sequence of images of type CV_8UC4. It is of HD size 1280x720. I'm executing the bgfg segmentation (MOG2 specifically) on a ROI of the image. After the algo finished I've got the binary image of the size of ROI and of type CV_8UC1. I want to insert this binary image back to the original big image. Hwo can I do this?
Here's what I'm doing (the code is simplified for the sake of readability):
// cvImage is the big Mat coming from outside
cv::Mat roi(cvImage, cv::Rect(200, 200, 400, 400));
mog2 = cv::createBackgroundSubtractorMOG2();
cv::Mat fgMask;
mog2->apply(roi, fgMask); // Here the fgMask is the binary mat which corresponds to the roi size
So, how can insert the fgMask back to the original image? Hwo to do this CV_8UC1 -> CV_8UC4 conversion only for the ROI?
Thank you.