Skip to content

Geometry: Crop by Default trims the fine-rotation/keystone wedge - #1125

Draft
PabloRuizCuevas wants to merge 1 commit into
marcinz606:mainfrom
PabloRuizCuevas:feat/pr-crop-by-default
Draft

PabloRuizCuevas wants to merge 1 commit into
marcinz606:mainfrom
PabloRuizCuevas:feat/pr-crop-by-default

Conversation

@PabloRuizCuevas

Copy link
Copy Markdown
Contributor

Summary

Fine Rotation, Tilt and Swing replicate a wedge of edge pixels to fill the corners of a rotated or keystoned frame, and until now the only fix was to crop it off by hand.

  • Adds a Crop by Default toggle to Alignment: whenever no manual or detected crop is set, the frame auto-crops live to the largest rect that Fine Rotation, Tilt and Swing leave void-free.
  • compute_geometry_crop_rect finds that rect numerically (ternary search over half-width, with a nested binary search for the largest valid half-height at each candidate — the safe region is a convex quadrilateral since both transforms are plane projectivities), shared by the CPU and GPU engines so there's one implementation, not two to keep in parity.
  • While a slider is adjusted, the canvas briefly darkens the margin it would trim, fading out after it settles, reusing Fine Rotation's own alignment-grid overlay mechanism.

Part of #1105; split out for focused review.

Testing

make all (lint + type + tests) passes, including new coverage in tests/test_crop_to_valid.py (the inscribed-rect search, avoids every void pixel across a spread of angles/keystone combos, GeometryProcessor wiring: computes a roi, yields to a manual or armed-auto crop, off leaves the frame untouched).

🤖 Generated with Claude Code

Adds a Crop by Default toggle to Alignment: whenever no manual or
detected crop is set, the frame auto-crops to the largest rect that
Fine Rotation, Tilt and Swing leave void-free, so no edge shows
replicated pixels. compute_geometry_crop_rect finds it numerically
(ternary + nested binary search over the convex safe region), shared
by the CPU and GPU engines. While a slider is adjusted, the canvas
briefly darkens the trimmed margin, fading like the fine-rotation
alignment grid it reuses.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant