4. OpenCV Image Quality

4.1 Function method: cv2.imwrite('yahboomTest.jpg', img, [cv2.IMWRITE_JPEG_QUALITY, 50])

Parameter meaning:

cv2.CV_IMWRITE_JPEG_QUALITY: Set the image quality of the image format to .jpeg or .jpg, the value is 0---100 (the larger the value, the higher the quality), the default is 95

cv2.CV_IMWRITE_WEBP_QUALITY: Set the image quality of the image format to .webp format, the value is 0--100

cv2.CV_IMWRITE_PNG_COMPRESSION: Set the compression ratio of the .png format, the value is 0--9 (the larger the value, the greater the compression ratio), the default is 3

4.2. Actual effect display

Code path:

/home/pi/project_demo/06.Open_source_cv_fundamentals_course/A.introduction/Introduction_to_OpenCV/04_OpenCV_Img_Quality.ipynb