I'm trying to set an image region of interest and add one image into another. One image is a mask (greyscale) and the other one is a color image. Right now, I'm doing
IplImage * _newImg = newImage.getCvImage();
IplImage * _oldBG = tempBG.getCvImage();
CvRect rect = cvRect(100, 100, _newImg->width, _newImg->height);
cvSetImageROI(_oldBG, rect);
cvAdd(_newImg, _oldBG, _newImg, NULL);
cvResetImageROI(_oldBG);
This causes the following error:
OpenCV Error: Assertion failed (src1.size() == src2.size()) in binaryMaskOp,
I've stepped through the code, and both images are the same size. I'm assuming the problem is that one image is color and the other is greyscale. Is there a way to perform the procedure above using images with different channels?
Thanks.