img = cv.imread('../images/girl.jpg',0)'''
cv.IMREAD_COLOR : Loads a color image.加载一张彩色图片,默认模式,图像的任何透明度都将被忽略。
cv.IMREAD_GRAYSCALE : Loads image in grayscale mode 灰度图
cv.IMREAD_UNCHANGED : 这样加载图像,包括Alpha通道
Instead of these three flags, you can simply pass integers 1, 0 or -1 respectively.
1:彩色图像
0:灰度图
-1:表示加载原图,不做任何改变
'''
'\ncv.IMREAD_COLOR : Loads a color image.加载一张彩色图片,默认模式,图像的任何透明度都将被忽略。\ncv.IMREAD_GRAYSCALE : Loads image in grayscale mode 灰度图\ncv.IMREAD_UNCHANGED : 这样加载图像,包括Alpha通道\n\nInstead of these three flags, you can simply pass integers 1, 0 or -1 respectively.\n1:彩色图像\n0:灰度图\n-1:表示加载原图,不做任何改变\n'
img = cv.imread('../images/girl.jpg',0)
cv.imshow('img', img)
k = cv.waitKey(0)if k ==27:# ESC to exit
cv.destroyAllWindows()elif k ==ord('s'):# s 键退出并保存
cv.imwrite('firstpro.jpg',img)
cv.destroyAllWindows()
import numpy as npimport cv2 as cv加载图片img = cv.imread('../images/girl.jpg', 0)'''cv.IMREAD_COLOR : Loads a color image.加载一张彩色图片,默认模式,图像的任何透明度都将被忽略。cv.IMREAD_GRAYSCALE : Loads image in grayscal...