Enhance VideoEditor with improved point transformation and tracking logic
This commit refines the point transformation process in the VideoEditor class by ensuring coordinates are converted to floats and validating their positions relative to the crop area. It also updates the right-click event handling to accurately convert display coordinates to original frame coordinates, allowing for better interaction with tracking points. Additionally, the MotionTracker class is modified to set a default zoom center based on the crop rect if none is provided, improving the tracking functionality.
This commit is contained in:
@@ -126,7 +126,13 @@ class MotionTracker:
|
||||
"""Start motion tracking with base positions"""
|
||||
self.tracking_enabled = True
|
||||
self.base_crop_rect = base_crop_rect
|
||||
self.base_zoom_center = base_zoom_center
|
||||
|
||||
# If no base_zoom_center is provided, use the center of the crop rect
|
||||
if base_zoom_center is None and base_crop_rect is not None:
|
||||
x, y, w, h = base_crop_rect
|
||||
self.base_zoom_center = (x + w//2, y + h//2)
|
||||
else:
|
||||
self.base_zoom_center = base_zoom_center
|
||||
|
||||
def stop_tracking(self):
|
||||
"""Stop motion tracking"""
|
||||
|
||||
Reference in New Issue
Block a user