Skip to content

fix(geometric): validate RotateImage scale is positive and finite#322

Open
Jayant-kernel wants to merge 2 commits intoc2siorg:mainfrom
Jayant-kernel:fix/rotateimage-scale-validation
Open

fix(geometric): validate RotateImage scale is positive and finite#322
Jayant-kernel wants to merge 2 commits intoc2siorg:mainfrom
Jayant-kernel:fix/rotateimage-scale-validation

Conversation

@Jayant-kernel
Copy link
Copy Markdown
Contributor

Description

Fixes RotateImage silently corrupting the output when scale is zero, negative, or non-finite.

With scale=0, cv2.getRotationMatrix2D maps every destination pixel to the image centre, producing a uniform solid-colour output with no error raised. Negative and non-finite values produce similarly unexpected results.

This adds the same class of validation already applied to ScaleImage (issue #302).

Fixes #320

Type of Change

  • Bug fix

How Has This Been Tested?

  • New tests added — tests/operators/geometric/test_rotate_image.py
    • default and valid params work correctly
    • scale=0, negative, inf, -inf, nan all raise ValueError
    • shape is preserved for valid inputs
  • Existing tests pass

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review
  • My changes generate no new warnings
  • Tests pass locally

@github-actions
Copy link
Copy Markdown

PR Review

Squash

Your PR has 2 commits. Please squash into a single commit.

How to fix

git fetch origin
git rebase -i origin/main   # mark all but first commit as "squash"
git push --force-with-lease

This comment updates automatically on each push.

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.

[Bug] RotateImage scale=0 or negative silently corrupts the image with no validation error

1 participant