@@ -35,9 +35,9 @@ class FunscriptGeneratorParameter:
3535 """ Funscript Generator Parameter Dataclass with default values """
3636 video_path : str
3737 track_men : bool
38+ supervised_tracking : bool
3839 metric : str
3940 projection : str
40- supervised_tracking : bool = True
4141
4242 # Settings
4343 start_frame : int = 0 # default is video start (input: set current video position)
@@ -393,6 +393,8 @@ def scale_score(self, status: str, metric : str = 'y') -> None:
393393 elif 'ou' in self .params .projection .split ('_' ):
394394 imgMin = imgMin [:int (imgMin .shape [0 ]/ 2 ), :]
395395 imgMax = imgMax [:int (imgMax .shape [0 ]/ 2 ), :]
396+ else :
397+ self .logger .warning ("Unknown VR Projection Type: %s" , self .params .projection )
396398
397399 if PROJECTION [self .params .projection ]['parameter' ]['width' ] > 0 :
398400 scale = PROJECTION [self .params .projection ]['parameter' ]['width' ] / float (1.75 * imgMax .shape [1 ])
@@ -671,7 +673,10 @@ def tracking(self) -> str:
671673 bbox_woman = self .get_bbox (first_frame , "Select Woman Feature" )
672674 preview_frame = self .draw_box (first_frame , bbox_woman , color = (255 ,0 ,255 ))
673675 if self .params .supervised_tracking :
674- tracking_area_woman = self .get_bbox (preview_frame , "Select the Supervised Tracking Area for the Woman Feature" )
676+ while True :
677+ tracking_area_woman = self .get_bbox (preview_frame , "Select the Supervised Tracking Area for the Woman Feature" )
678+ if StaticVideoTracker .is_bbox_in_tracking_area (bbox_woman , tracking_area_woman ): break
679+ self .logger .error ("Invalid supervised tracking area selected" )
675680 preview_frame = self .draw_box (preview_frame , tracking_area_woman , color = (0 ,255 ,0 ))
676681 tracker_woman = StaticVideoTracker (first_frame , bbox_woman , supervised_tracking_area = tracking_area_woman )
677682 else :
@@ -682,7 +687,10 @@ def tracking(self) -> str:
682687 bbox_men = self .get_bbox (preview_frame , "Select Men Feature" )
683688 preview_frame = self .draw_box (preview_frame , bbox_men , color = (255 ,0 ,255 ))
684689 if self .params .supervised_tracking :
685- tracking_area_men = self .get_bbox (preview_frame , "Select the Supervised Tracking Area for the Men Feature" )
690+ while True :
691+ tracking_area_men = self .get_bbox (preview_frame , "Select the Supervised Tracking Area for the Men Feature" )
692+ if StaticVideoTracker .is_bbox_in_tracking_area (bbox_men , tracking_area_men ): break
693+ self .logger .error ("Invalid supervised tracking area selected" )
686694 tracker_men = StaticVideoTracker (first_frame , bbox_men , supervised_tracking_area = tracking_area_men )
687695 else :
688696 tracker_men = StaticVideoTracker (first_frame , bbox_men )
@@ -720,15 +728,15 @@ def tracking(self) -> str:
720728 # Process data from last step while the next tracking points get predicted.
721729 # This should improve the whole processing speed, because the tracker run in a seperate thread
722730 bboxes ['Woman' ][frame_num - 1 ] = bbox_woman
723- last_frame = self .draw_box (last_frame , bboxes ['Woman' ][frame_num - 1 ])
731+ last_frame = self .draw_box (last_frame , bboxes ['Woman' ][frame_num - 1 ], color = ( 0 , 255 , 0 ) )
724732 if self .params .supervised_tracking :
725733 last_frame = self .draw_box (last_frame , tracking_area_woman , color = (0 ,255 ,0 ))
726734
727735 if self .params .track_men :
728736 bboxes ['Men' ][frame_num - 1 ] = bbox_men
729- last_frame = self .draw_box (last_frame , bboxes ['Men' ][frame_num - 1 ])
737+ last_frame = self .draw_box (last_frame , bboxes ['Men' ][frame_num - 1 ], color = ( 255 , 0 , 255 ) )
730738 if self .params .supervised_tracking :
731- last_frame = self .draw_box (last_frame , tracking_area_men , color = (0 , 255 ,0 ))
739+ last_frame = self .draw_box (last_frame , tracking_area_men , color = (255 ,0 , 255 ))
732740
733741 last_frame = self .draw_fps (last_frame )
734742 cv2 .putText (last_frame , "Press 'q' if the tracking point shifts or a video cut occured" ,
0 commit comments