Ask Your Question

Revision history [back]

The pointer returns by the VideoCapture object can be used directly, you need to copy it, otherwise im and im2 refer to the same memory zone (that's why the result is black). Make a copy, like this:

cam1 >> im;
im.copyTo( im2 );
cam1 >> im;
im.copyTo( im3 ); // not really needed in that case
Mat im4 = im2 - im3;