OpenCV imshow and Windows 10 scaling issue

asked 2018-05-03 05:41:31 -0500

draxus gravatar image

updated 2018-05-03 05:43:30 -0500

I was having a problem with OpenCV imshow function showing images larger than they actually were (See image attached, where left side is the original size, and right one is the image in an OpenCV window).

import cv2
img = cv2.imread('image.png')
cv2.namedWindow('a', cv2.WINDOW_AUTOSIZE)
cv2.imshow('a', img)
cv2.waitKey()

/upfiles/1525343616855845.jpg

After some hours of investigation, I found out that the problem was Windows 10 scaling settings. This value was enabled to 125% by default. Changing this value to 100% in "Windows Settings - Display - Scale and layout" fixed the issue.

/upfiles/15253441954431951.png

Not sure if this expected behaviour or not, but I just would like to share it for others.

edit retag flag offensive close merge delete

Comments

2

Related issue / feature request: imshow upscale displayed image.

Eduardo gravatar imageEduardo ( 2018-05-03 06:05:36 -0500 )edit