OpenCV image writing

Function method: cv2.imwrite('yahboom1.jpg', img).

The first parameter is the saved filename and the second parameter is the saved image.

Below we demonstrate the method of image writing. First, read an image yahboom.jpg, and then write yahboom1.jpg.

After entering the Raspberry Pi 5 desktop, open a terminal and run the following command to start the container corresponding to Dofbot:

Access Jupyter Lab within Docker:

Code path:/root/Dofbot/4.opencv/1.OpenCV_basic/02_write_pic.ipynb

The cv2.imshow('yahboom, img) function in jupyLab cannot be executed. If you need to use this sentence to display the read image, you need to execute the python file through the command, command: python3 XX.py

When the code block finishes running, you can see that the yahboom.jpg image is written to yahboom1.jpg.