1 | initial version |
if you really make it "equal halves", your video will look like shit, also text is more or less a "horizontal" thing, so i propose a slightly different idea:
#1: make a nice large empty image:
draw = np.zeros((480,800,3), dtype=np.uint8)
#2: resize the cam frame to 640x480 (keeping a decent aspect ratio)
frame = cv2.resize(frame, (640,480))
#3: blit it into the large img
draw[0:480, 0:640, :] = frame
#4: draw it
cv2.imshow("XXX", draw)
#5: update the window (should go *after* imshow())
if cv2.waitKey(1) & 0xFF == ord('q'):
break
this will leave you with a 800x160 drawing space below the cam img, and another 360x480 region on the right
2 | No.2 Revision |
if you really make it "equal halves", your video will look like shit, also text is more or less a "horizontal" thing, so i propose a slightly different idea:
#1: make a nice large empty image:
draw = np.zeros((480,800,3), dtype=np.uint8)
#2: resize the cam frame to 640x480 (keeping a decent aspect ratio)
frame = cv2.resize(frame, (640,480))
#3: blit it into the large img
draw[0:480, 0:640, :] = frame
#4: draw it
cv2.imshow("XXX", draw)
#5: update the window (should go *after* imshow())
if cv2.waitKey(1) & 0xFF == ord('q'):
break
this will leave you with a 800x160 drawing space below the cam img, and another 360x480 160x480 region on the right
3 | No.3 Revision |
if you really make it "equal halves", your video will look like shit, also text is more or less a "horizontal" thing, so i propose a slightly different idea:
#1: make a nice large empty image:
draw = np.zeros((480,800,3), dtype=np.uint8)
#2: resize the cam frame to 640x480 (keeping a decent aspect ratio)
frame = cv2.resize(frame, (640,480))
#3: blit it into the large img
draw[0:480, 0:640, :] = frame
#3.a: your text rendering into the "draw" mat
# (your code here !)
#4: draw show it
cv2.imshow("XXX", draw)
#5: update the window (should go *after* imshow())
if cv2.waitKey(1) & 0xFF == ord('q'):
break
this will leave you with a 800x160 drawing space below the cam img, and another 160x480 region on the right