This commit is contained in:
iperov 2019-03-26 16:08:17 +04:00
commit d533319076

View file

@ -303,21 +303,24 @@ class InteractColab(InteractBase):
return True return True
def on_destroy_all_windows(self): def on_destroy_all_windows(self):
clear_output() pass
#clear_output()
def on_create_window (self, wnd_name): def on_create_window (self, wnd_name):
clear_output() pass
#clear_output()
def on_show_image (self, wnd_name, img): def on_show_image (self, wnd_name, img):
# cv2 stores colors as BGR; convert to RGB pass
if img.ndim == 3: # # cv2 stores colors as BGR; convert to RGB
if img.shape[2] == 4: # if img.ndim == 3:
img = cv2.cvtColor(img, cv2.COLOR_BGRA2RGBA) # if img.shape[2] == 4:
else: # img = cv2.cvtColor(img, cv2.COLOR_BGRA2RGBA)
img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB) # else:
img = PIL.Image.fromarray(img) # img = cv2.cvtColor(img, cv2.COLOR_BGR2RGB)
plt.imshow(img) # img = PIL.Image.fromarray(img)
plt.show() # plt.imshow(img)
# plt.show()
def on_capture_mouse (self, wnd_name): def on_capture_mouse (self, wnd_name):
pass pass