OpenCV & Python - Image too big to display

后端 未结 7 1939
猫巷女王i
猫巷女王i 2020-12-04 23:33

I have an image that is 6400 × 3200, while my screen is 1280 x 800. Therefore, the image needs to be resized for display only. I am using Python and OpenCV 2.4.9. According

相关标签:
7条回答
  • 2020-12-05 00:10

    Although I was expecting an automatic solution (fitting to the screen automatically), resizing solves the problem as well.

    import cv2
    cv2.namedWindow("output", cv2.WINDOW_NORMAL)        # Create window with freedom of dimensions
    im = cv2.imread("earth.jpg")                        # Read image
    imS = cv2.resize(im, (960, 540))                    # Resize image
    cv2.imshow("output", imS)                            # Show image
    cv2.waitKey(0)                                      # Display the image infinitely until any keypress
    
    0 讨论(0)
提交回复
热议问题