The first step involves is importing the image using OpenCV:
- We will load the image using the imread function and display it using the imshow function. Let's import the libraries and load the image:
In[1]: import cv2
In[2]: image = cv2.imread('test_image.jpg')
In[3]: cv2.imshow('input_image', image)
In[4]: cv2.waitKey(0)
In[5]: cv2.destroyAllWindows()
- The imported image looks as follows:Â
Fig 5.1: The input image
In the next section, we will convert the RGB image into a grayscale image.