Article ID: 000088871 Content Type: Troubleshooting Last Reviewed: 05/20/2022

Is It Possible to Scale Image to Full Screen with OpenCV*?

BUILT IN - ARTICLE INTRO SECOND COMPONENT
Summary

Workaround to scale image to full screen with OpenCV

Description
  • Created a new window and set the window's property to full screen using OpenCV*:

    import cv2
    cv2.namedWindow("Window_name", cv2.WINDOW_NORMAL)
    cv2.setWindowProperty("Window_name", cv2.WND_PROP_FULLSCREEN, cv2.WINDOW_FULLSCREEN)

  • Image was displayed in full screen but maintained in its original size:

    img = cv2.imread(image.jpg, 1)
    cv2.imshow("Window_name", img)

  • Unable to determine how to scale the image to full screen.
Resolution

cv2.WINDOW_NORMAL fits window to full screen, but it doesn't support image resize. Hence, the image is not being scaled to full screen as the window.

Resize the image to the screen resolution before passing it to imshow().

Related Products

This article applies to 2 products