Once OpenCV is installed on your Raspberry Pi, you can start working on one of the widely used image processing library. In this section, you will learn how to perform basic image operations such as opening an image, reading an image, saving the image to other format and pixel manipulation, and so on. You will also learn about arithmetic operation on images, reading a video file, and opening a video file.
Open your terminal window and create a new folder titled
chapter5in which you will put all your code by executing the following command:
cd /home/pi/ mkdir chapter5
Create a new python file using this code:
Copy any of the image file to the
chapter5folder. I had the
test.jpgimage in the folder. Copy the following command in the file using this code:
#import the python opencv module import cv2 #imread will read an image img=cv2...