@@ -280,7 +280,7 @@ def min_max_selector(self,
280280 (self .x_text_start , 50 ), cv2 .FONT_HERSHEY_SIMPLEX , self .font_size , (0 ,0 ,255 ), 2 )
281281 cv2 .putText (preview , "Set {} to {}" .format ('Max' , trackbarValueMax ),
282282 (image_min .shape [1 ] + self .x_text_start , 50 ), cv2 .FONT_HERSHEY_SIMPLEX , self .font_size , (0 ,0 ,255 ), 2 )
283- cv2 .imshow (self .window_name , self .preview_scaling (preview ))
283+ cv2 .imshow (self .window_name , self .preview_scaling (preview , 1.1 ))
284284 if self .was_space_pressed () or cv2 .waitKey (25 ) == ord (' ' ): break
285285 trackbarValueMin = cv2 .getTrackbarPos ("Min" , self .window_name )
286286 trackbarValueMax = cv2 .getTrackbarPos ("Max" , self .window_name )
@@ -352,9 +352,9 @@ def scale_score(self, status: str, direction : str = 'y') -> None:
352352 imgMax = imgMax [:int (imgMax .shape [0 ]/ 2 ), :]
353353
354354 if PROJECTION [self .params .projection ]['parameter' ]['width' ] > 0 :
355- scale = PROJECTION [self .params .projection ]['parameter' ]['width' ] / float (2 * imgMax .shape [1 ])
355+ scale = PROJECTION [self .params .projection ]['parameter' ]['width' ] / float (1.75 * imgMax .shape [1 ])
356356 else :
357- scale = PROJECTION [self .params .projection ]['parameter' ]['height' ] / float (2 * imgMax .shape [1 ])
357+ scale = PROJECTION [self .params .projection ]['parameter' ]['height' ] / float (1.75 * imgMax .shape [0 ])
358358 imgMin = cv2 .resize (imgMin , None , fx = scale , fy = scale )
359359 imgMax = cv2 .resize (imgMax , None , fx = scale , fy = scale )
360360
@@ -451,20 +451,21 @@ def delete_last_tracking_predictions(self, num :int) -> None:
451451 if self .params .track_men : del self .bboxes ['Men' ][- 1 ]
452452
453453
454- def preview_scaling (self , preview_image :np .ndarray ) -> np .ndarray :
454+ def preview_scaling (self , preview_image :np .ndarray , post_scale : float = 1.0 ) -> np .ndarray :
455455 """ Scale image for preview
456456
457457 Args:
458458 preview_image (np.ndarray): opencv image
459+ post_scale (float, optional): additional scaling factor
459460
460461 Returns:
461462 np.ndarray: scaled opencv image
462463 """
463464 return cv2 .resize (
464465 preview_image ,
465466 None ,
466- fx = self .params .preview_scaling ,
467- fy = self .params .preview_scaling
467+ fx = self .params .preview_scaling * post_scale ,
468+ fy = self .params .preview_scaling * post_scale
468469 )
469470
470471
@@ -678,7 +679,7 @@ def tracking(self) -> str:
678679
679680 if self .was_key_pressed ('q' ) or cv2 .waitKey (1 ) == ord ('q' ):
680681 status = 'Tracking stopped by user'
681- self .delete_last_tracking_predictions (int ((self .get_average_tracking_fps ()+ 1 )* 2.2 ))
682+ self .delete_last_tracking_predictions (int ((self .get_average_tracking_fps ()+ 1 )* 2.0 ))
682683 break
683684
684685 (successWoman , bboxWoman ) = trackerWoman .result ()
@@ -756,7 +757,8 @@ def finished(self, status: str, success :bool) -> None:
756757 status (str): a process status/error message
757758 success (bool): True if funscript was generated else False
758759 """
759- cv2 .destroyWindow (self .window_name )
760+ try : cv2 .destroyWindow (self .window_name )
761+ except : pass
760762 self .funscriptCompleted .emit (self .funscript , status , success )
761763
762764
@@ -907,6 +909,10 @@ def create_funscript(self, idx_dict: dict) -> None:
907909
908910 def run (self ) -> None :
909911 """ The Funscript Generator Thread Function """
912+ if self .params .direction == 'd' and not self .params .track_men :
913+ self .finished ("Tracking with 'd' and no men tracker is not implemented!" , False )
914+ return
915+
910916 # NOTE: score['y'] and score['x'] should have the same number size so it should be enouth to check one score length
911917 with Listener (on_press = self .on_key_press ) as listener :
912918 status = self .tracking ()
0 commit comments