January 2018
Intermediate to advanced
268 pages
6h 20m
English
We can save this image as a file as well, and change the original image format to PNG:
import cv2img = cv2.imread('images/input.jpg')cv2.imwrite('images/output.png', img, [cv2.IMWRITE_PNG_COMPRESSION])
The imwrite() method will save the grayscale image as an output file named output.png. This is done using PNG compression with the help of ImwriteFlag and cv2.IMWRITE_PNG_COMPRESSION. The ImwriteFlag allows the output image to change the format, or even the image quality.
Read now
Unlock full access