opencv updating code to c++

I have a very small simple function using opencv libraries which takes a source image and stamps it to a location on a destination image.
No matter why I try I am getting nowhere trying to update it to a c++ format.
Here is the original.
1
2
3
4
5
6
7
8
9
10
11
12
void coriolus::stamp(                                                          //Removes the black portion of the input image from source and places at r coordinates in dst
    IplImage * src,                                                            /// The small image you want to copy
    IplImage * dst,                                                            /// The big image to go into
    CvRect r                                                                   ///region in the large image to copy into
          ){
      IplImage * mask = cvCloneImage(src);
      cvNot(mask,mask);               // This takes all of the white pixels in the src image and makes them black (i.e., 0)
      cvSetImageROI(dst, r);          // Sets the location in the big image to put the small image
      cvCopy(src,dst,mask);           // The mask makes sure all the white pixels aren't copied.
      cvResetImageROI(dst);           // resets region of interest
      cvReleaseImage(&mask);          // cleanup
}


I actually thought it would be something simple like
1
2
3
4
5
6
7
8
9

void stamp(Mat src, Mat dst, Rect r)
{
    Mat mask = src.clone();
    bitwise_not(mask,mask);
    dst.adjustROI( Rect(r) );
    src.copyTo(dst,mask);
}


what am I missing?
Topic archived. No new replies allowed.