python opencv 转为灰色图片

# coding:utf-8
import cv2 as cv

img = cv.imread("a.jpg", cv.IMREAD_GRAYSCALE)
cv.imwrite('grayscale_4.jpg', img)

if __name__ == "__main__":
    pass

  

posted @ 2021-12-10 17:00  brady-wang  阅读(170)  评论(0编辑  收藏  举报