Python cv2.imwrite(): Save Images with OpenCV
The 'cv2.imwrite()' function is used in OpenCV (cv2) library for Python to save an image to a file. Here is the syntax:
cv2.imwrite(filename, image)
- 'filename': The name of the output file.
- 'image': The image data that needs to be saved.
Example:
import cv2
# Load an image
image = cv2.imread('input.jpg')
# Save the image with a different name
cv2.imwrite('output.jpg', image)
In this example, 'cv2.imread()' is used to load the image from a file named 'input.jpg'. Then, 'cv2.imwrite()' is used to save the image with a different name as 'output.jpg'.
原文地址: https://www.cveoy.top/t/topic/qhFs 著作权归作者所有。请勿转载和采集!