Disable multi-scale template matching by default in VideoEditor and update state management
This commit changes the default setting for multi-scale template matching to false, streamlining the initial configuration. It also updates the state management to include the multi-scale setting, ensuring that the user's preference is preserved across sessions. Additionally, the display information has been enhanced to reflect the current template matching status, improving user feedback during video editing.
This commit is contained in:
@@ -882,7 +882,7 @@ class VideoEditor:
|
|||||||
self.tracking_template = None
|
self.tracking_template = None
|
||||||
self.template_region = None
|
self.template_region = None
|
||||||
self.template_match_history = [] # Store recent match confidences for adaptive thresholding
|
self.template_match_history = [] # Store recent match confidences for adaptive thresholding
|
||||||
self.multi_scale_template_matching = True # Enable multi-scale by default # (x, y, w, h) in rotated frame coordinates
|
self.multi_scale_template_matching = False # Disable multi-scale by default # (x, y, w, h) in rotated frame coordinates
|
||||||
self.template_selection_start = None
|
self.template_selection_start = None
|
||||||
self.template_selection_rect = None
|
self.template_selection_rect = None
|
||||||
|
|
||||||
@@ -933,7 +933,8 @@ class VideoEditor:
|
|||||||
'tracking_points': {str(k): v for k, v in self.tracking_points.items()},
|
'tracking_points': {str(k): v for k, v in self.tracking_points.items()},
|
||||||
'feature_tracker': self.feature_tracker.get_state_dict(),
|
'feature_tracker': self.feature_tracker.get_state_dict(),
|
||||||
'template_matching_enabled': self.template_matching_enabled,
|
'template_matching_enabled': self.template_matching_enabled,
|
||||||
'template_region': self.template_region
|
'template_region': self.template_region,
|
||||||
|
'multi_scale_template_matching': self.multi_scale_template_matching
|
||||||
}
|
}
|
||||||
|
|
||||||
with open(state_file, 'w') as f:
|
with open(state_file, 'w') as f:
|
||||||
@@ -1027,7 +1028,9 @@ class VideoEditor:
|
|||||||
if 'template_region' in state and state['template_region'] is not None:
|
if 'template_region' in state and state['template_region'] is not None:
|
||||||
self.template_region = state['template_region']
|
self.template_region = state['template_region']
|
||||||
# Recreate template from region when needed
|
# Recreate template from region when needed
|
||||||
self.tracking_template = None # Will be recreated on first use
|
self.tracking_template = None
|
||||||
|
if 'multi_scale_template_matching' in state:
|
||||||
|
self.multi_scale_template_matching = state['multi_scale_template_matching'] # Will be recreated on first use
|
||||||
|
|
||||||
# Validate cut markers against current video length
|
# Validate cut markers against current video length
|
||||||
if self.cut_start_frame is not None and self.cut_start_frame >= self.total_frames:
|
if self.cut_start_frame is not None and self.cut_start_frame >= self.total_frames:
|
||||||
@@ -2946,13 +2949,18 @@ class VideoEditor:
|
|||||||
feature_text = f" | Features: {feature_count} pts"
|
feature_text = f" | Features: {feature_count} pts"
|
||||||
if self.optical_flow_enabled:
|
if self.optical_flow_enabled:
|
||||||
feature_text += " (OPTICAL FLOW)"
|
feature_text += " (OPTICAL FLOW)"
|
||||||
|
template_text = (
|
||||||
|
f" | Template: {self.template_matching_enabled}" if self.template_matching_enabled else ""
|
||||||
|
)
|
||||||
|
if self.template_matching_enabled and self.multi_scale_template_matching:
|
||||||
|
template_text += " (MULTI-SCALE)"
|
||||||
autorepeat_text = (
|
autorepeat_text = (
|
||||||
f" | Loop: ON" if self.looping_between_markers else ""
|
f" | Loop: ON" if self.looping_between_markers else ""
|
||||||
)
|
)
|
||||||
if self.is_image_mode:
|
if self.is_image_mode:
|
||||||
info_text = f"Image | Zoom: {self.zoom_factor:.1f}x{rotation_text}{brightness_text}{contrast_text}{motion_text}{feature_text}"
|
info_text = f"Image | Zoom: {self.zoom_factor:.1f}x{rotation_text}{brightness_text}{contrast_text}{motion_text}{feature_text}{template_text}"
|
||||||
else:
|
else:
|
||||||
info_text = f"Frame: {self.current_frame}/{self.total_frames} | Speed: {self.playback_speed:.1f}x | Zoom: {self.zoom_factor:.1f}x{seek_multiplier_text}{rotation_text}{brightness_text}{contrast_text}{motion_text}{feature_text}{autorepeat_text} | {'Playing' if self.is_playing else 'Paused'}"
|
info_text = f"Frame: {self.current_frame}/{self.total_frames} | Speed: {self.playback_speed:.1f}x | Zoom: {self.zoom_factor:.1f}x{seek_multiplier_text}{rotation_text}{brightness_text}{contrast_text}{motion_text}{feature_text}{template_text}{autorepeat_text} | {'Playing' if self.is_playing else 'Paused'}"
|
||||||
cv2.putText(
|
cv2.putText(
|
||||||
canvas,
|
canvas,
|
||||||
info_text,
|
info_text,
|
||||||
|
Reference in New Issue
Block a user