Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

OpenCV imshow and Windows 10 scaling issue

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()

C:\fakepath\379dd530-ec32-4b33-a8ca-55a03cc9ab27.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.

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

OpenCV imshow and Windows 10 scaling issue

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()

C:\fakepath\379dd530-ec32-4b33-a8ca-55a03cc9ab27.jpg/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.

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

OpenCV imshow and Windows 10 scaling issue

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.