Reputation: 7742
My goal is to simply display image using openCV2. Here is the code:
import cv2
img2 = cv2.imread('opencv_logo.png')
cv2.imshow('img2', img2)
cv2.waitKey(0)
cv2.destroyAllWindows()
Here is how original image looks:
Here is how openCV is displaying it:
I cannot understand why there is a grey area added?
This on Python 3.4.3, openCV 3.1.0 and Win 7
Upvotes: 0
Views: 166
Reputation: 20160
I've observed that the opencv highgui windows have some minimum width.
If your image is smaller than that minimum window size, the rest of the space is filled with whatever is in the window buffer atm. This might not be a problem, if you always render images of same (too small) size, but it might give unwanted behaviour if you first render a big image and afterwards an image that is too small, because some pixels of the big image will still be displayed. When I face this problem I typically either resize my too small image or render a black image before rendering a too small image.
Upvotes: 1