continuous drift detection
This commit is contained in:
parent
5177eea77e
commit
d7bd2fe6cd
1 changed files with 98 additions and 92 deletions
|
|
@ -191,7 +191,6 @@ class StitchingScanner:
|
||||||
"""
|
"""
|
||||||
offset = AlignmentOffset()
|
offset = AlignmentOffset()
|
||||||
|
|
||||||
with self._mosaic_lock:
|
|
||||||
if self.mosaic is None:
|
if self.mosaic is None:
|
||||||
return offset
|
return offset
|
||||||
|
|
||||||
|
|
@ -381,7 +380,8 @@ class StitchingScanner:
|
||||||
y_offset = y_offset - int(round(alignment_y))
|
y_offset = y_offset - int(round(alignment_y))
|
||||||
|
|
||||||
# Clamp x_offset to valid range
|
# Clamp x_offset to valid range
|
||||||
x_offset = max(0, min(x_offset, w_base - blend_w))
|
# x_offset = max(0, min(x_offset, w_base - blend_w))
|
||||||
|
x_offset = 0 - min(x_offset, w_base)
|
||||||
|
|
||||||
# Handle strip cropping if y_offset is negative (strip protrudes above frame)
|
# Handle strip cropping if y_offset is negative (strip protrudes above frame)
|
||||||
strip_y_start = 0 # How much to crop from top of strip
|
strip_y_start = 0 # How much to crop from top of strip
|
||||||
|
|
@ -837,7 +837,7 @@ class StitchingScanner:
|
||||||
no_movement_count = 0
|
no_movement_count = 0
|
||||||
max_no_movement = 50
|
max_no_movement = 50
|
||||||
stop_reason = 'stopped'
|
stop_reason = 'stopped'
|
||||||
|
self.log(f"Scanning 2..")
|
||||||
while self.running and not self.paused:
|
while self.running and not self.paused:
|
||||||
if time.time() - start_time > self.config.max_scan_time:
|
if time.time() - start_time > self.config.max_scan_time:
|
||||||
self.log("Scan timeout")
|
self.log("Scan timeout")
|
||||||
|
|
@ -871,6 +871,7 @@ class StitchingScanner:
|
||||||
curr_frame = self._capture_frame()
|
curr_frame = self._capture_frame()
|
||||||
dx, dy = self._detect_displacement_robust(self._prev_frame, curr_frame)
|
dx, dy = self._detect_displacement_robust(self._prev_frame, curr_frame)
|
||||||
|
|
||||||
|
self.log(f"Scanning dx{dx} dy{dy}..")
|
||||||
self._displacement_since_append_x += dx
|
self._displacement_since_append_x += dx
|
||||||
self._displacement_since_append_y += dy
|
self._displacement_since_append_y += dy
|
||||||
total_x += dx
|
total_x += dx
|
||||||
|
|
@ -885,6 +886,8 @@ class StitchingScanner:
|
||||||
|
|
||||||
# Edge detection
|
# Edge detection
|
||||||
movement = abs(dx) if direction in [ScanDirection.RIGHT, ScanDirection.LEFT] else abs(dy)
|
movement = abs(dx) if direction in [ScanDirection.RIGHT, ScanDirection.LEFT] else abs(dy)
|
||||||
|
|
||||||
|
self.log(f"Scanning movement{movement}..")
|
||||||
if movement < 1.0:
|
if movement < 1.0:
|
||||||
no_movement_count += 1
|
no_movement_count += 1
|
||||||
if no_movement_count >= max_no_movement:
|
if no_movement_count >= max_no_movement:
|
||||||
|
|
@ -896,7 +899,10 @@ class StitchingScanner:
|
||||||
|
|
||||||
# Append when threshold reached (with continuous alignment)
|
# Append when threshold reached (with continuous alignment)
|
||||||
disp = abs(self._displacement_since_append_x) if direction in [ScanDirection.RIGHT, ScanDirection.LEFT] else abs(self._displacement_since_append_y)
|
disp = abs(self._displacement_since_append_x) if direction in [ScanDirection.RIGHT, ScanDirection.LEFT] else abs(self._displacement_since_append_y)
|
||||||
|
|
||||||
|
self.log(f"Scanning disp{disp}..")
|
||||||
if disp >= threshold_pixels:
|
if disp >= threshold_pixels:
|
||||||
|
self.log(f"Scanning threshold_pixels..")
|
||||||
self._append_strip(curr_frame, direction)
|
self._append_strip(curr_frame, direction)
|
||||||
self.log(f"Appended {disp:.1f}px, mosaic: {self.state.mosaic_width}x{self.state.mosaic_height}, align: ({self._cumulative_align_x:.1f}, {self._cumulative_align_y:.1f})")
|
self.log(f"Appended {disp:.1f}px, mosaic: {self.state.mosaic_width}x{self.state.mosaic_height}, align: ({self._cumulative_align_x:.1f}, {self._cumulative_align_y:.1f})")
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue