简体   繁体   中英

How to draw shape for each image color and how to set number for each of the color?

The image has 11 different colors.

An example showing what I need to get is given in the picture:

例子

I need to map each color to number and to see shape.

Thanks

If you got the Color in an Array of x,y try

xdiff,ydiff=np.Gradient(Colormap)
shape=np.Logical_and(xdiff,ydiff) 

it should give you an Image of the spots were the Color changes.

np.unique(Colormap)

gives you all the Colors present

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM