Use OpenCV

Save an Image with imwrite

You can use the cv2 imwrite function to save an image to a file.

The method takes two arguments:

  1. The name of the file to which you want to save your image, and;
  2. The cv2 image object that you want to save into the file.

To use the imwrite function, use the following code:


cv2.imwrite("image.jpeg", image)

Next steps

OpenCV can be used with the open source supervision Python package.

supervision provides an extensive range of functionalities for working with computer vision models. With supervision, you can:

1. Process and filter detections and segmentation masks from a range of popular models (YOLOv5, Ultralytics YOLOv8, MMDetection, and more).
2. Process and filter classifications.
3. Compute confusion matrices.

And more! To learn about the full range of functionality in supervision, check out the supervision documentation.