Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

function trouble upgrading from c 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.

void coriolus::stamp(IplImage * src, IplImage *dst, CvRect r) { IplImage * mask = cvCloneImage(src); cvNot(mask,mask); cvSetImageROI(dst, r); cvCopy(src,dst,mask); cvResetImageROI(dst); cvReleaseImage(&mask);
}

I actually thought it would be something simple like

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?

function trouble upgrading from c 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.

void coriolus::stamp(IplImage * src, IplImage *dst, CvRect r) { IplImage * mask = cvCloneImage(src); cvNot(mask,mask); cvSetImageROI(dst, r); cvCopy(src,dst,mask); cvResetImageROI(dst); cvReleaseImage(&mask);
}

I actually thought it would be something simple like

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?

function trouble upgrading from c 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 what I try I am getting nowhere trying to update it to a c++ format. Here is the original.

void coriolus::stamp(IplImage * src, IplImage *dst, CvRect r) { IplImage * mask = cvCloneImage(src); cvNot(mask,mask); cvSetImageROI(dst, r); cvCopy(src,dst,mask); cvResetImageROI(dst); cvReleaseImage(&mask);
}

I actually thought it would be something simple like

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?

click to hide/show revision 4
No.4 Revision

updated 2014-03-16 11:47:26 -0600

berak gravatar image

function trouble upgrading from c 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 what I try I am getting nowhere trying to update it to a c++ format. Here is the original.

void coriolus::stamp(IplImage * src, IplImage *dst, CvRect r)
{
      IplImage * mask = cvCloneImage(src);
      cvNot(mask,mask);
      cvSetImageROI(dst, r);
      cvCopy(src,dst,mask); 
      cvResetImageROI(dst); 
      cvReleaseImage(&mask); 
}

}

I actually thought it would be something simple like

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?