Saving Images
cv2.imwrite() method is used to save an image to any storage device. This will save the image according to the specified format in the current working directory.
Example: Python OpenCV Save Images
Python3
# Python program to explain cv2.imwrite() method # importing cv2 import cv2 image_path = 'geeks.png' # Using cv2.imread() method # to read the image img = cv2.imread(image_path) # Filename filename = 'savedImage.jpg' # Using cv2.imwrite() method # Saving the image cv2.imwrite(filename, img) # Reading and showing the saved image img = cv2.imread(filename) cv2.imshow( "w3wiki" , img) cv2.waitKey( 0 ) cv2.destroyAllWindows() |
Output:
Getting Started with Python OpenCV
Computer Vision is one of the techniques from which we can understand images and videos and can extract information from them. It is a subset of artificial intelligence that collects information from digital images or videos.
Python OpenCV is the most popular computer vision library. By using it, one can process images and videos to identify objects, faces, or even handwriting of a human. When it is integrated with various libraries, such as NumPy, python is capable of processing the OpenCV array structure for analysis.
In this article, we will discuss Python OpenCV in detail along with some common operations like resizing, cropping, reading, saving images, etc with the help of good examples.