【Opencv & matplotlib】选择一个颜色系来画bounding box或者画线条

import matplotlib.cm as cmx
import matplotlib.colors as mcolors

def ColorsList():
    def get_cmap(N):
        color_norm = mcolors.Normalize(0, N - 1)
        return cmx.ScalarMappable(color_norm, 'hsv').to_rgba
    NUM_COLORS = 12
    cmap = get_cmap(NUM_COLORS)
    colors = [cmap(float(i)) for i in range(NUM_COLORS)]
    return colors
colorlist = ColorsList()
'''
colorlist = np.array([(1.0, 0.0, 0.0, 1.0),
 (1.0, 0.532721120956415, 0.0, 1.0),
 (0.93455775808717001, 1.0, 0.0, 1.0),
 (0.40183663713075479, 1.0, 0.0, 1.0),
 (0.0, 1.0, 0.15404569495487538, 1.0),
 (0.0, 1.0, 0.68676345978601616, 1.0),
 (0.0, 0.78051739264974551, 1.0, 1.0),
 (0.0, 0.24779627169333063, 1.0, 1.0),
 (0.30808663713075457, 0.0, 1.0, 1.0),
 (0.84080775808717012, 0.0, 1.0, 1.0),
 (1.0, 0.0, 0.62647112095641488, 1.0),
 (1.0, 0.0, 0.09375, 1.0)]
)*255
此颜色系可以用来画bbox
'''

 

你可能感兴趣的:(opencv3.2.0)