Return None When There Isn't Meaningful Letterboxing#75
Open
Return None When There Isn't Meaningful Letterboxing#75
None When There Isn't Meaningful Letterboxing#75Conversation
The current implementation will return the original image if there isn't any meaningful letterboxing around the image. This PR changes that so that the caller knows if an image was modified or not.
Contributor
There was a problem hiding this comment.
Pull request overview
This PR changes the behavior of the unletterbox function to return None when no meaningful letterboxing is detected, instead of returning the full image bounds. This allows callers to distinguish between images that were actually modified versus those that didn't need processing.
Changes:
- Modified
unletterboxto returnNonewhen letterboxing is not detected or not meaningful - Updated
load_and_preprocessto handle the newNonereturn value correctly - Updated tests to expect
Noneinstead of full image bounds for unchanged images
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| perception/hashers/tools.py | Changed three return statements from returning full image bounds (0, w), (0, h) to returning None, and updated documentation |
| perception/local_descriptor_deduplication.py | Updated load_and_preprocess to check if unletterbox returns None and only crop if bounds are returned; removed unnecessary parentheses in lambda |
| tests/test_tools.py | Updated tests to expect None instead of full image bounds; added formatting improvements; contains a critical bug in test_ffmpeg_video |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
The current implementation will return the original image if there isn't any meaningful letterboxing around the image. This PR changes that so that the caller knows if an image was modified or not.