Free Motion Capture for Everyone πβ¨
TypeScript
fairly complete sequence map for FMC_MultiCamera
jon matthis516820b7f60f
diff --git a/freemocap/dev_scratchpad/dev_alpha/FMC_MultiCamera.py b/freemocap/dev_scratchpad/dev_alpha/FMC_MultiCamera.pyindex cc11ae79..e0e8e223 100644--- a/freemocap/dev_scratchpad/dev_alpha/FMC_MultiCamera.py+++ b/freemocap/dev_scratchpad/dev_alpha/FMC_MultiCamera.py@@ -100,7 +100,7 @@ class FMC_MultiCamera:self._show_multi_cam_stream = show_multi_cam_stream- rich_console.rule('Starting FreeMoCap MultiCam Recorder!')+ rich_console.rule('Starting FreeMoCap MultiCam!')@@ -243,10 +243,10 @@ class FMC_MultiCamera:tuple(in_barrier_list),tuple(in_exit_event_list),)- self.incoming_frame_grabber_thread = threading.Thread(target=self.grab_incoming_cam_tuples, name='Incoming Frame Grabber Thread')- self.incoming_frame_grabber_thread.start()- if self._show_multi_cam_stream:- self.show_multi_cam_cv2()+ self.incoming_tuple_grabber_thread = threading.Thread(target=self.grab_incoming_cam_tuples, name='Incoming Frame Tuple Grabber Thread')+ self.incoming_tuple_grabber_thread.start()+ if self._show_multi_cam_stream or self.standalone_mode:+ self.show_multi_cam_opencv()@@ -288,7 +288,7 @@ class FMC_MultiCamera:self._each_cam_timestamps_unix_ns = np.vstack((self._each_cam_timestamps_unix_ns, these_timestamps)) #result will be numpy array with `num_frames` rows and `num_cams` columnsself.multi_cam_tuple_queue.put(this_multi_cam_tuple, np.mean(these_timestamps))- multi_cam_image = np.hstack(these_images_list) #create multiFrame_image by stitching together incoming camera images+rich_console.log('Created a multi_cam_tuple - queue size: {}'.format(self.multi_cam_tuple_queue.qsize()))@@ -306,7 +306,7 @@ class FMC_MultiCamera:for this_cam_num in range(self.num_cams):- these_images_list[this_cam_num] = multi_cam_tuple[this_cam_num][0] #and that's how you navigate nested tuples, lol+ these_images_list[this_cam_num] = multi_cam_tuple[this_cam_num][1] #and that's how you navigate nested tuples, lolmulti_cam_image = np.hstack(these_images_list) #create multiFrame_image by stitching together (horizontally stacking) incoming camera images (matrices)return multi_cam_image@@ -321,9 +321,9 @@ class FMC_MultiCamera:### ββ ββ ββ ββ ββ ββ βββ ββ ββ ββ ββ ββ ββ### βββββββ ββ ββ ββββββ βββ βββ ββββ ββ ββββββ###- ###+ ### 6- def show_multi_cam_cv2(self):+ def show_multi_cam_opencv(self):"""display multi_cam_image using `cv2.imshow` and maybe save it to mp4, who knows?"""rich_console.rule('Launching Multi Cam Viewer')@@ -463,8 +463,8 @@ if __name__ == '__main__':pathos_mp_helper.freeze_support()console = Console() #create rich console to catch and print exceptionstry:- fmc_multi_cam_recorder = FMC_MultiCamera()- fmc_multi_cam_recorder.start(standalone_mode=True)+ multi_cam = FMC_MultiCamera()+ multi_cam.start(standalone_mode=True)except Exception:console.print_exception()diff --git a/freemocap/dev_scratchpad/dev_alpha/FreeMoCap_Alpha_Mermaid_Flow_Diagram.md b/freemocap/dev_scratchpad/dev_alpha/FreeMoCap_Alpha_Mermaid_Flow_Diagram.mddeleted file mode 100644index 593b090e..00000000--- a/freemocap/dev_scratchpad/dev_alpha/FreeMoCap_Alpha_Mermaid_Flow_Diagram.md+++ /dev/null@@ -1,62 +0,0 @@-# FMC_Camera-## Run as __Main__ file-```mermaid-%%{init: {"securityLevel": "loose","theme": "base", "themeVariables": { "fontSize":"24px","primaryColor": "#fff4dd", "primaryTextColor":"#f4f4fd", "actorBkg":"#FF0000", "loopTextColor":"#fff000"}}}%%--sequenceDiagram-autonumber- participant M as __Main__- participant I as FMC_Camera.__init__()- participant S as cam.show()- participant R as self.read_next_frame()- activate M--- M->>+I:create "cam" as context manger- Note right of I: create "cam" with default values- I->>-M:return "cam"- M->>+S:Launch video stream window (OpenCV)- loop Display Video - cam.show()- S->>+R:self.read_next_frame()- deactivate S- R->>R:read frame - self.cv2_cap.read()- R->>R:record timestamp to self- R->>-S:return (success, image, timestamp_unix_ns)- activate S- S->>S:Display image: cv2.imshow()- S->>S:print "camName read an image at.." to console- S->>S:Exit on window close of ESC key- end- S->>-M:break----- deactivate M---```--```mermaid-classDiagram- class FMC_Camera{- +[int] cam_num = 0- +[queue] frame_queue = None- +[barrier] barrier = None- +[event] exit_event = None- +[bool] show_cam_stream = False- +[rich_console] rich_console = None,- +[bool] show_console = False,- +[dict] cap_parameters_dict = cap_default_parameters_dict,- +[bool] vid_save_path=None,- __init__()- show_cam_stream(self, show_cam_stream_bool=True)- open(self)- show(self)- run_in_thread(self)- __enter__()- __exit__()- }--```-