Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

i think, you're just lacking some refs:

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

the important one is: Mat &dst , without it, the dst Mat won't get the roi updated ( only the pixels), because you're passing in a copy

i think, you're just lacking some refs:

void stamp(const Mat &src, Mat &dst, const Rect &r)
{
    Mat mask = src.clone();
    bitwise_not(mask,mask);
    // hmm, adjustROI is not exactly the same as the c-code above
    // i can only guess here, but i think, you wanted this:
    // src.copyTo( dst(r), mask );
    dst.adjustROI( Rect(r) r );
    src.copyTo(dst,mask);
}

the important one is: Mat &dst , without it, the dst Mat won't get the roi updated ( only the pixels), because you're passing in a copy