Created
June 29, 2020 06:21
-
-
Save p3jitnath/904ce98d09e5f5785eb98d99171ab214 to your computer and use it in GitHub Desktop.
Custom OpenCV font
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import cv2 | |
import numpy as np | |
img = np.zeros((100, 300, 3), dtype=np.uint8) | |
ft = cv2.freetype.createFreeType2() | |
ft.loadFontData(fontFileName='Ubuntu-R.ttf', | |
id=0) | |
ft.putText(img=img, | |
text='Quick Fox', | |
org=(15, 70), | |
fontHeight=60, | |
color=(255, 255, 255), | |
thickness=-1, | |
line_type=cv2.LINE_AA, | |
bottomLeftOrigin=True) | |
cv2.imwrite('image.png', img) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
👍