Skip to content

Instantly share code, notes, and snippets.

@himaprasoonpt
Created February 9, 2019 13:51
Show Gist options
  • Save himaprasoonpt/b78cda9b964266316e5e150053d6c2ba to your computer and use it in GitHub Desktop.
Save himaprasoonpt/b78cda9b964266316e5e150053d6c2ba to your computer and use it in GitHub Desktop.
OpenCV python show image
import cv2
def show_image(img, wait_key=0, text="image", fx=0.5, fy=0.3):
"""
Utility to show image
:param img: Image array
:param wait_key: Wait key to stop showing
:param text: Text to be displayed
:param fx: resize factor in x dimension
:param fy: resize factor in y dimension
:return:
"""
img = cv2.resize(src=img, dsize=(0, 0), fx=fx, fy=fy)
cv2.imshow(text, img)
cv2.waitKey(wait_key)
cv2.destroyAllWindows()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment