Python grayscale image to binary image

Python grayscale image to binary image

img = cv2.imread("G:/imgHui/jiaoshi.jpg")
    Grayimg = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    ret, thresh = cv2.threshold(Grayimg, 120, 225,cv2.THRESH_BINARY)
    cv2.imwrite('G:/imgHui/2.jpg', thresh)

The
first parameter of the threshold is the grayscale image and the
second parameter is the threshold

Published 4 original articles · received 0 · views 1741

Guess you like

Origin blog.csdn.net/E_TanChi/article/details/85225491