Improve robustness and error handling in image cropping and polygon rectification#4767
Open
purvi1508 wants to merge 4 commits intoPaddlePaddle:release/3.3from
Open
Improve robustness and error handling in image cropping and polygon rectification#4767purvi1508 wants to merge 4 commits intoPaddlePaddle:release/3.3from
purvi1508 wants to merge 4 commits intoPaddlePaddle:release/3.3from
Conversation
purvi1508
commented
Nov 26, 2025
- Added bounding box existence and empty image checks in minmax_size_ to prevent paste errors on padded images.
- Wrapped cv2.getPerspectiveTransform and cv2.warpPerspective in try/except in get_rotate_crop_image to avoid OpenCV crashes.
- Added validation for polygon validity and area in get_poly_rect_crop to skip invalid or too-small polygons.
- Updated rectification return logic in get_poly_rect_crop to handle empty crops and ensure a valid image is returned.
- These changes improve stability for processing images with tables, irregular polygons, or edge cases that previously caused errors like "!ssize.empty() in resize".
Refine image padding logic to handle bounding box cases.
Add check for None coordinates in image processing
Added boundary checks for cropping coordinates and error handling for perspective transformation.
Handle case where cropped image is empty by returning the original image.
|
Thanks for your contribution! |
Collaborator
|
Hello, PaddlePaddle: release/3.3 has been finalized and will no longer merge any additional pull requests (PRs). The changes in the current PR cannot be presented (i.e., reflected) in other versions of PaddleX either. Please cherry-pick the modifications and then submit the PR to the develop branch of PaddleX. |
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.