Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Subract one mat from another if a condition is met

I have 2 matrices of the same size. One of which has a "black area" where all the values are Scalar(0,0,0). I want to subtract the other matrix from this one but only in places where it isn't black (I want to leave the black alone). Id prefer not to iterate over the entire matrix if possible. I believe this is done using a mask but I am unclear how to set that up.

Thanks In Advance