Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

The Mat assignment operator doesn't copy data, it just copy pointers. To copy data use copyTo method:

blue_channel.copyTo( result_channel( Rect(0, 0, cols, rows) ) );
green_channel.copyTo( result_channel( Rect(cols, 0, cols, rows) ) );
red_channel.copyTo( result_channel( Rect(cols*2, 0, cols, rows) ) );