Skip to content

Instantly share code, notes, and snippets.

@felipessalvatore
Created February 7, 2018 20:26
Show Gist options
  • Save felipessalvatore/0198ad58239e31fa189ccdc254989cba to your computer and use it in GitHub Desktop.
Save felipessalvatore/0198ad58239e31fa189ccdc254989cba to your computer and use it in GitHub Desktop.
write on image using cv2
import cv2
img = cv2.imread("0.png")
font = cv2.FONT_HERSHEY_PLAIN
bottomLeftCornerOfText = (15,25)
fontScale = 1
fontColor = (255,25,55)
lineType = 2
cv2.putText(img,"""up: 0.02""",
bottomLeftCornerOfText,
font,
fontScale,
fontColor,
lineType)
cv2.putText(img,"""down: 0.03""",
(15,38),
font,
fontScale,
fontColor,
lineType)
cv2.putText(img,"""left: 0.03""",
(15,52),
font,
fontScale,
fontColor,
lineType)
cv2.putText(img,"""right: 0.03""",
(15,66),
font,
fontScale,
fontColor,
lineType)
# #Display the image
# cv2.imshow("img",img)
#Save image
cv2.imwrite("out.jpg", img)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment