out = [] for im in self: if im.iscolor: R = gamma_decode(m.red, gamma) G = gamma_decode(im.green, gamma) B = gamma_decode(im.blue, gamma) out.append(np.dstack((R, G, B))) else: out.append(gamma_decode(im.image, gamma)) return self.__class__(out) # --------------------------------------------------------------------------# if __name__ == '__main__': # test run ImageProcessingColor.py print('ImageProcessingColor.py') from machinevisiontoolbox.Image import Image im = Image('monalisa.png') im.disp() imcs = Image.showcolorspace() imcs.disp() import code code.interact(local=dict(globals(), **locals()))
for i in range(len(b)): icont[i] = i colors[i] = (rng.randint(0, 256), rng.randint(0, 256), rng.randint(0, 256)) cv.rectangle(drawing, (b[i].umin, b[i].vmin), (b[i].umax, b[i].vmax), colors[i], thickness=2) # cv.putText(drawing, str(i), (int(b[i].uc), int(b[i].vc)), # fontFace=cv.FONT_HERSHEY_SIMPLEX, fontScale=1, # color=colors, thickness=2) drawing = b.drawBlobs(im, drawing, icont, colors, contourthickness=cv.FILLED) # mvt.idisp(drawing) # import matplotlib.pyplot as plt # plt.imshow(d2) # plt.show() # mvt.idisp(d2) im2 = Image('images/multiblobs_edgecase.png') im2.disp() # press Ctrl+D to exit and close the image at the end import code code.interact(local=dict(globals(), **locals()))