All the available fonts in OpenCV are as follows:
- FONT_HERSHEY_SIMPLEX = 0
- FONT_HERSHEY_PLAIN = 1
- FONT_HERSHEY_DUPLEX = 2
- FONT_HERSHEY_COMPLEX = 3
- FONT_HERSHEY_TRIPLEX = 4
- FONT_HERSHEY_COMPLEX_SMALL = 5
- FONT_HERSHEY_SCRIPT_SIMPLEX = 6
- FONT_HERSHEY_SCRIPT_COMPLEX = 7
In connection with this, we have coded the text_drawing_fonts.py script, which plots all the available fonts. As all these fonts are in the (0-7) range, we can iterate and call the cv2.putText() function, varying the color, fontFace, and org parameters. We have also plotted lowercase and uppercase versions of these fonts. The key piece of code to perform this functionality is as follows:
position = (10, 30)for i in range(0, 8): cv2.putText(image