Chapter 03 - Image Processing and Acquisition using Python_Part7
Chapter 03 - Image Processing and Acquisition using Python_Part7
import cv2
We import cv2 and use the cv2.imread function to read the image
as an ndarray. To convert a color image to grayscale, we use the
function cvtColor whose first argument is the ndarray of an image
and the second argument is cv2.COLOR BGR2GRAY. This argument,
cv2.COLOR BGR2GRAY, converts an RGB image, which is a three-
channel ndarray to grayscale, which is a single-channel ndarray using
the following formula: