Draw Text with cv2.putText

Tutorial

You can use the OpenCV putText  method to draw text onto an image loaded with the OpenCV package.

To draw text, you can use the following code:


cv2.putText(
		image, # image on which to draw text
		'Text to write', 
    (200,200), # bottom left corner of text
    cv2.FONT_HERSHEY_SIMPLEX, # font to use
    1, # font scale
    (255, 0, 0), # color
    1, # line thickness
)

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.