📜  如何使用 cv2.COLOR_BGR2GRAY - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:05.720000             🧑  作者: Mango

代码示例1
def main():
    imagePath = "img.jpg"
    
    img = cv2.imread(imagePath)
    gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
    
    generate_histogram(gray)
    
    cv2.imwrite("before.jpg", gray)

    gray = cv2.equalizeHist(gray)
    
    generate_histogram(gray)
    
    cv2.imwrite("after.jpg",gray)
    
    return 0