程序示例:
import cv2
img=cv2.imread("1.png",cv2.IMREAD_UNCHANGED)
result=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imshow("lena",img)
cv2.imshow("result",result)
cv2.waitKey()
cv2.destroyAllWindows()
结果:
程序示例:
import cv2
img=cv2.imread("1.png",cv2.IMREAD_UNCHANGED)
result=cv2.cvtColor(img,cv2.COLOR_BGR2GRAY)
cv2.imshow("lena",img)
cv2.imshow("result",result)
cv2.waitKey()
cv2.destroyAllWindows()
结果: