7 examples of 'opencv imshow' in Python

Every line of 'opencv imshow' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.

All examples are scanned by Snyk Code

By copying the Snyk Code Snippets you agree to
75def imshow_cv(label, im, block=False, text=None, wait=2):
76 vis = im.copy()
77 print_status(vis, text=text)
78 window_manager.imshow(label, vis)
79 ch = cv2.waitKey(0 if block else wait) & 0xFF
80 if ch == ord(' '):
81 cv2.waitKey(0)
82 if ch == ord('v'):
83 print('Entering debug mode, image callbacks active')
84 while True:
85 ch = cv2.waitKey(10) & 0xFF
86 if ch == ord('q'):
87 print('Exiting debug mode!')
88 break
89 if ch == ord('s'):
90 fn = 'img-%s.png' % time.strftime("%Y-%m-%d-%H-%M-%S")
91 print 'Saving %s' % fn
92 cv2.imwrite(fn, vis)
93 elif ch == 27 or ch == ord('q'):
94 sys.exit(1)
31def imshow(X):
32 img = X.reshape(32, 16)
33 import cv2
34 img = cv2.resize(img, (100, 200), interpolation=cv2.INTER_AREA)
35 img = img.astype('uint8')
36 cv2.imshow("", img)
37 cv2.waitKey(0)
12def imshow(self, arr, save_img=None):
13 if self.window is None:
14 height, width, channels = arr.shape
15 self.window = pyglet.window.Window(width=width, height=height, display=self.display, caption="THOR Browser")
16 self.width = width
17 self.height = height
18 self.isopen = True
19
20 assert arr.shape == (self.height, self.width, 3), "You passed in an image with the wrong number shape"
21 image = pyglet.image.ImageData(self.width, self.height, 'RGB', arr.tobytes(), pitch=self.width * -3)
22 self.window.clear()
23 self.window.switch_to()
24 self.window.dispatch_events()
25 image.blit(0,0)
26 self.window.flip()
27 if self.save_dir and save_img is not None:
28 pyglet.image.get_buffer_manager().get_color_buffer().save(
29 join(self.save_dir, 'action_{:04d}.png'.format(save_img)))
8def showimg(img,nm="pic"):
9 cv2.imshow(nm,img)
10 return cv2.waitKey()
10def show_img(pic, name='pic', x=0, y=0, wait=0):
11 cv2.imshow(name, pic)
12 cv2.moveWindow(name, x, y)
13 cv2.waitKey(wait)
14 cv2.destroyAllWindows()
121def show(self):
122 """Show image."""
123 cv2.imshow("image", self.images['current'])
124 cv2.waitKey(0)
125 cv2.destroyAllWindows()
652def imshow(img, title="", cmap="gray", cbar=False):
653 """ Show image to screen. """
654
655 plt.imshow(img, cmap=cmap)
656 plt.title(title)
657
658 if cbar:
659 plt.colorbar()
660
661 plt.show()

Related snippets