python - Color image based on K classes and colors -


i have written code take image in, segment out important objects, , calculate features objects. broke objects in k classes k = 5 - 35 different representations. now, given k, save mask each of objects different color.

what struggling determine, method identify colors use different object classes.

basically looking function:

get_rgb(k): 

where k number of classes , return list of rgb (or other color representation). using python , have been trying use color_maps in matplotlib, have not been successful that.

thanks help.

edit: looking k different colors use. if k = 3, [[255,0,0],[0,255,0],[0,0,255]]. these colors used mask input image, can already, need way determine colors.

it seems trying generate k distinct colors. there many solutions here already: how automatically generate n "distinct" colors? (it has solution in python has function want).


Comments