[英]How to find resolution of an image in OpenCV
Is there a way to find a resolution for an image in OpenCV.有没有办法在 OpenCV 中找到图像的分辨率。 I'm not looking for width and height, but the resolution.
我不是在寻找宽度和高度,而是在寻找分辨率。
I can find the resolution in ImageMagick like this:我可以像这样在 ImageMagick 中找到分辨率:
identify -format "%wx %h %xx %y" mypic.jpg 4175 x 4175 300 x 300%
The resolution for the above image is 300
上图的分辨率是
300
This might be a bit late, but you can use the .shape
property of any image in OpenCV.这可能有点晚了,但您可以使用 OpenCV 中任何图像的
.shape
属性。 So, here's some sample code to illustrate how use can use this.所以,这里有一些示例代码来说明 use 如何使用它。
#importing the module cv2
import cv2
#reading the image whose dimensions are to be found using imread() function
image = cv2.imread('input.jpg')
#using shape property to get the dimensions of the image
dimensions = image.shape
print(dimensions)
Hope this answers your question.希望这能回答你的问题。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.