I have a CV_32SC1-type Mat, let’s call it segm. segm stores class information after calling the watershed function. Say its possible values are -1(class boundary), 1, 2.
Now, how can I make a mask for the pixels labelled with “2”? That is I need a mat which is 1 iff segm is 2, otherwise 0.
I could do this mask with writing a loop, but I think there must be some OpenCV library function that does it, I just could not find it. Does anyone know here the proper way?
Finally, I have found it: