formatting

This commit is contained in:
Naoto Kondo
2022-03-19 15:11:44 +09:00
parent 9314c5e7f1
commit 5b8865158e

View File

@@ -3,6 +3,7 @@ import numpy as np
import cv2 as cv import cv2 as cv
import NDIlib as ndi import NDIlib as ndi
def main(): def main():
if not ndi.initialize(): if not ndi.initialize():
@@ -34,12 +35,12 @@ def main():
cv.startWindowThread() cv.startWindowThread()
while True: while True:
t,v,_,_ = ndi.recv_capture_v2(ndi_recv, 5000) t, v, _, _ = ndi.recv_capture_v2(ndi_recv, 5000)
if t == ndi.FRAME_TYPE_VIDEO: if t == ndi.FRAME_TYPE_VIDEO:
print("Video data received (%dx%d)." % (v.xres, v.yres)) print('Video data received (%dx%d).' % (v.xres, v.yres))
frame = np.copy(v.data) frame = np.copy(v.data)
cv.imshow('ndi image',frame) cv.imshow('ndi image', frame)
ndi.recv_free_video_v2(ndi_recv, v) ndi.recv_free_video_v2(ndi_recv, v)
if cv.waitKey(1) & 0xff == 27: if cv.waitKey(1) & 0xff == 27:
@@ -51,5 +52,6 @@ def main():
return 0 return 0
if __name__ == "__main__": if __name__ == "__main__":
sys.exit(main()) sys.exit(main())