def stream(quit, det):
"""
:param quit: Quit streaming
:param det: detection object
:return:
"""
global sav_frame
global sav_result
camera_src = None
if args.device == str(0): # jetson
camera_src = CameraSrc().get_cam_src()
else: # desktop
camera_src = 0
camera = cv2.VideoCapture(camera_src)
assert camera.isOpened()
if args.fullscreen:
cv2.namedWindow(args.device, cv2.WINDOW_NORMAL)
cv2.setWindowProperty(args.device,
cv2.WND_PROP_FULLSCREEN,
cv2.WINDOW_FULLSCREEN)
face_locs = None
alignedFace = None
while True:
_, frame = camera.read()
sav_frame = frame.copy()
# add frames to queue
frame_queue.put(sav_frame)
# display detection results
#face_locs = face_coordinates_queue.get()
#alignedFace = face_aligned_queue.get()
#if face_locs is not None:
# print(len(alignedFace), face_locs)
#det.display(frame=frame, face_locations=face_locs)
cv2.imshow(args.device, frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
quit.value = 1
break
camera.release()
cv2.destroyAllWindows()
# Main Process
评论列表
文章目录