Skip to content

Instantly share code, notes, and snippets.

@robobe
Created July 2, 2021 14:23
Show Gist options
  • Save robobe/8ddf66e69b9f2bfe05e778ea9198e71a to your computer and use it in GitHub Desktop.
Save robobe/8ddf66e69b9f2bfe05e778ea9198e71a to your computer and use it in GitHub Desktop.
Generated image from numpy array
import cv2
import numpy as np
import time
from timeit import default_timer as timer
HEIGHT=480
WIDTH=640
FONT=cv2.FONT_HERSHEY_SIMPLEX
bottomLeftCornerOfText = (100,100)
FONT_SCALE=2
fontColor = (0,255,0)
lineType = 2
start = timer()
while True:
frame = np.zeros((HEIGHT, WIDTH,3), np.uint8)
end = timer()
delta_sec = round(end-start, 2)
cv2.putText(frame,str(delta_sec),
bottomLeftCornerOfText,
FONT,
FONT_SCALE,
fontColor,
lineType)
cv2.imshow("win", frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
time.sleep(1/30)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment