c++ - Combining two matrices, preserving their element value -


i'm using opencv in c++. have 2 single channel matrices, 1 values of either 0 or 2, other either values 0 or 3 each element. want combine 2 use mask in grabcut function.

i merge them such new combined matrix contains either 0, 2, or 3, appropriate. tried bitwise or operation, seems gives me matrix values 0 or 255 exclusively 3 or 2 is.

combined = (greenmaskforgrabcut == 3) | (redmaskforgrabcut == 2); 

how can preserve 3 or 2 values each element? thanks

opencv has bitwise_or operation arrays:

http://docs.opencv.org/modules/core/doc/operations_on_arrays.html

void bitwise_or(inputarray src1, inputarray src2, outputarray dst, inputarray mask=noarray())


Comments

Popular posts from this blog

cakephp - simple blog with croogo -

How to group boxplot outliers in gnuplot -

bash - Performing variable substitution in a string -