ORB - added cam video looping, added python 2.7 compatibility. Made test view work off of video. Added pose cells and initial view cells.

This commit is contained in:
SimLeek
2018-03-27 11:07:43 -07:00
parent 9f3063c1c4
commit 5d7fd03656
3 changed files with 13 additions and 2 deletions
+5
View File
@@ -9,3 +9,8 @@ class CamCtrl:
def stop_cam(cam_id # type: Union[int, str]
):
pubsub.publish("cvcamhandlers." + str(cam_id) + ".cmd", 'q')
@staticmethod
def reset_vid(cam_id # type: Union[int, str]
):
pubsub.publish("cvcamhandlers." + str(cam_id) + ".cmd", 'r')
+6 -1
View File
@@ -29,6 +29,7 @@ def pub_cam_loop(cam_id, # type: Union[int, str]
msg = ''
cam = cv2.VideoCapture(cam_id)
# cam.set(cv2.CAP_PROP_CONVERT_RGB, 0)
frame_counter = 0
if high_speed:
cam.set(cv2.CAP_PROP_FOURCC, cv2.CAP_OPENCV_MJPEG)
@@ -48,10 +49,14 @@ def pub_cam_loop(cam_id, # type: Union[int, str]
cam.release()
pubsub.publish("cvcams." + str(cam_id) + ".status", "failed")
return False
if cam.get(cv2.CAP_PROP_FRAME_COUNT) > 0:
frame_counter+=1
if frame_counter >= cam.get(cv2.CAP_PROP_FRAME_COUNT):
frame_counter = 0
cam = cv2.VideoCapture(cam_id)
pubsub.publish("cvcams." + str(cam_id) + ".vid", (frame,))
msg = listen_default(sub, block=False, empty='')
pass
cam.release()
return True
+2 -1
View File
@@ -8,7 +8,7 @@ frame_dict = {}
# todo: figure out how to get the red x button to work. Try: https://stackoverflow.com/a/37881722/782170
def sub_win_loop(*,
def sub_win_loop(
names, # type: List[str]
input_vid_global_names, # type: List[str]
callbacks=(None,),
@@ -31,3 +31,4 @@ def sub_win_loop(*,
for c in input_cams:
CamCtrl.stop_cam(c)
return