greyscale image opencv python code example
Example 1: convert image to grayscale opencv
img = cv2.imread(path)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
Example 2: cvtcolor rgb to gray
cv::Mat img
cv::cvtColor(img, img, CV_BGR2GRAY);
img = cv2.imread(path)
img_gray = cv2.cvtColor(img, cv2.COLOR_BGR2GRAY)
cv::Mat img
cv::cvtColor(img, img, CV_BGR2GRAY);