[英]Get image size in pixels using opencv2-python
I need the width and height of the image in pixels
using opencv2(python) 我需要使用opencv2(python) in pixels
的图像的宽度和高度
I tried using im.shape
but I dont think it gives the output in pixel units. 我尝试使用im.shape
但我不认为它以像素为单位提供输出。
I measured the pixel units using page ruler
extension and somehow it doesnt match with im.shape
output. 我使用page ruler
扩展来测量像素单位,但它与im.shape
输出不匹配。
Can anyone please tell me the units of im.shape and how to convert it into pixels? 谁能告诉我im.shape的单位以及如何将其转换为像素?
you could use Pillow library as following: 您可以按以下方式使用枕头库:
from PIL import Image
print(Image.open(args["image"]).size)
Hope it helps to someone! 希望对别人有帮助!
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.