Created
January 16, 2017 19:45
-
-
Save IanMcT/1a6537458f9847e388b7f4e053544bbf to your computer and use it in GitHub Desktop.
How to write on an image
This file contains 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 numpy as np | |
import cv2 | |
# Create a black image | |
#img = np.zeros((512,512,3), np.uint8) | |
img = cv2.imread('images/test_image.png') | |
# Write some Text | |
font = cv2.FONT_HERSHEY_SIMPLEX | |
cv2.putText(img,'Hello World!',(10,200), font, 1,(255,255,255),2) | |
#Display the image | |
cv2.imshow("img",img) | |
#Save image | |
cv2.imwrite("out.jpg", img) | |
cv2.waitKey(0) | |
# | |
# | |
# | |
# font = cv2.FONT_HERSHEY_SIMPLEX | |
# cv2.putText(img,'Hello World!',(10,500), font, 1,(255,255,255),2) | |
cv2.imwrite('images/writtenon.png',img) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment