Geometry: Crop by Default trims the fine-rotation/keystone wedge - #1125
Draft
PabloRuizCuevas wants to merge 1 commit into
Draft
PabloRuizCuevas wants to merge 1 commit into
PabloRuizCuevas wants to merge 1 commit into
Conversation
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.
compute_geometry_crop_rectfinds 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.Part of #1105; split out for focused review.
Testing
make all(lint + type + tests) passes, including new coverage intests/test_crop_to_valid.py(the inscribed-rect search, avoids every void pixel across a spread of angles/keystone combos,GeometryProcessorwiring: computes a roi, yields to a manual or armed-auto crop, off leaves the frame untouched).🤖 Generated with Claude Code