How to create a mask where from another Mat color condition

asked 2017-07-08 08:46:56 -0600

arqam gravatar image

updated 2017-07-09 02:12:00 -0600

berak gravatar image

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?

edit retag flag offensive close merge delete

Comments

1

All samples are here and for mask I thnik you find an answer in this sample

LBerger gravatar imageLBerger ( 2017-07-08 08:56:03 -0600 )edit