How to create a mask where from another Mat color condition
In an image Mat there are two color strokes. White and Black. (other colors also there)
In the mask that I need to create, the white stroke should be white and the black should be black.
The python code for that is :
# newmask is the mask image I manually labelled
2 newmask = cv2.imread('newmask.png',0)
3
4 # whereever it is marked white (sure foreground), change mask=1
5 # whereever it is marked black (sure background), change mask=0
6 mask[newmask == 0] = 0
7 mask[newmask == 255] = 1
So how can it be done it Java? Do I need to loop behind or anything?
All samples are here and for mask I thnik you find an answer in this sample