Untitled

mail@pastecode.io avatar
unknown
plain_text
a year ago
471 B
0
Indexable
Never
import cv2

def rgb_to_gray(image_path):
    image = cv2.imread(image_path)

    if image is None:
        print("Error the Image is not found...")
    else:
        gray_image = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
        cv2.imshow('Original Image', image)
        cv2.imshow('Grayscale Image', gray_image)
        cv2.waitKey(0)
        cv2.destroyAllwindows()
if __name__ == "__main__":
    image_path = input("Image: ")
    rgb_to_gray(image_path)