macOS python3 opencv 读取和写入图像

版权声明:本文为博主原创文章,可以自由转载。 https://blog.csdn.net/u010953692/article/details/83867257

python opencv 图像 读取 写入

1,读取和写入图像

#! /usr/local/bin/python3
# coding:utf-8
import cv2 
#读取图像
img = cv2.imread("/Users/y50/captcha_png.png")
print (img.shape)
print (img.shape[0:2])
print (type(img.shape))
h,w = img.shape[0:2]
print ( "高,宽:", h , w)
#保存图像
cv2.imwrite("/Users/y50/captcha_png.jpg" , img)
(50, 192, 3)
(50, 192)
<class 'tuple'>
高,宽: 50 192

参考:

  1. Basic Operations on Images

猜你喜欢

转载自blog.csdn.net/u010953692/article/details/83867257