def plot_masked_centroid_image(image, segmap): c_image = colors.quantize_from_centroid(image, segmap) f = pp.figure() mask = np.ones(c_image.shape, "bool") mask.shape = (-1, 3) mask[segmap.ravel() <= 0] = 0 pp.imshow(np.ma.MaskedArray(c_image, mask=mask)) f.axes[0].xaxis.set_visible(False) f.axes[0].yaxis.set_visible(False) return f
def mean_color_image(image, segmap): c_image = colors.quantize_from_centroid(image, segmap) return c_image