Python实现图像处理:PIL与OpenCV提取图像大小的方法与区别
发布时间
阅读量:
阅读量
当进行Python图像处理时,在PIL库中通常会使用image.size这一属性,在OpenCV库中则使用image.shape来获取形状信息。两者有何不同?可以参考下方程序运行的结果。
补充说明:要运行该程序的前提条件是确保您的系统已安装了Pillow和OpenCV的依赖库包。具体操作步骤请参考<>一文详细说明。
补充说明:要运行该程序的前提条件是确保您的系统已安装了Pillow和OpenCV的依赖库包。具体操作步骤请参考<>一文详细说明。
from PIL import Image
image = Image.open('/Users/alice/Documents/Develop/PythonCode/imagetest.JPG')
print(image.size)
执行的结果为:
(1672, 1364)
from PIL import Image
image = Image.open('/Users/alice/Documents/Develop/PythonCode/imagetest.JPG')
weight,high = image.size
print('(%s,%s)' % (high,weight))
print(im
全部评论 (0)
还没有任何评论哟~
