Untitled

 avatar
unknown
plain_text
2 years ago
471 B
3
Indexable
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)
Editor is loading...