I am using namedWindow() function in my code to resize the image's window. The mouse cursor showing i can resize the windows, but it actually can't. Here is my code
import numpy as np
import cv2
img=cv2.imread('/home/jeff/Downloads/iphone.png', 1)
cv2.namedWindow('image',cv2.WINDOW_NORMAL)
cv2.imshow('image',img)
cv2.waitKey(0)
cv2.destroyAllWindows()
Please assist. Thanks.
Replace code line cv2.namedWindow('image',cv2.WINDOW_NORMAL) with following:
cv2.namedWindow('image',cv2.WINDOW_AUTOSIZE)
There is a bug (at least in v3.2.0) that the resizing does not work if the image is bigger than the screen resolution. See the issue on GitHub.
Related
When I try to import the image into Tableau as floating, the resolution becomes awful, how do I fix this? I have tried importing different file formats: png, and jpg of the same picture but the result is the same.
Could you try with fixed image option.
or
Use horizontal/vertical container use it as fixed and then put image container in it as floating.
I am trying to load an image with cv2.imread().
It works fine when width>height. However, when height>width, the output is sometimes rotated.
Is there a way to avoid this rotation?
Thank you
I have Ubuntu 16.04. I have converted image through terminal using the following command:
convert myfigure.png myfigure.jpg
But I want to resize the height and width of the converted image. Is there any way to do this?
You can use the imutils python package.
import imutils
frameData = vs.read()
frameData = imutils.resize(frameData, width=600)
This should help.
Image is too large for uploading, size is 2160*2880.
here is the code:
cv.imshow only show partial content of this image. but if I save image with cv.imwrite and open the saved image with an application. image have all the content.
Is this a bug or cv2 or I miss something?
import cv2
cv2.namedWindow('image', cv2.WINDOW_AUTOSIZE)
img = cv2.imread("0.png")
cv2.imshow("image", img)
cv2.waitKey(0)
cv2.imwrite("xxx.png", img)
cv2.WINDOW_AUTOSIZE fix the window dimentions , so the image will fill the screen if too big
Try cv2.WINDOW_NORMAL which gives you the ability to change the window size.
after the save you maybe only use imread without namedWindow! (there isn't any other clear explanation)
Suggestion: You can use matplotlib for the show job, it has many parameters to use..
Is there a way in getting this sizes? Using command line. Thanks in advance. and can I ask something good tutorials in Dart?
I don't know a built-in feature that allows to do that except readying the content byte-wise and interpreting the values like explained for C++ in C++ How to get the Image size of a png file (in directory)
The image package seems to provide this functionality though. decodePng returns an image that has a width and height property.
The build-in function decodeImageFromList() can help you with that. Its callback contains an Image that includes the width and height.