Skip to content

test: cover image warping and undistortion geometry - #139

Merged
petercorke merged 2 commits into
petercorke:mainfrom
RoboX2020:test/image-reshape-warps
Oct 17, 2026
Merged

petercorke merged 2 commits into
petercorke:mainfrom
RoboX2020:test/image-reshape-warps

Conversation

@RoboX2020

Copy link
Copy Markdown
Contributor

Fixes #53.

Replace the five empty reshape-test stubs with geometric checks against analytic intensity ramps:

  • warp: half-pixel sampling.
  • warp_affine: translation, inverse mapping and border fill.
  • warp_perspective: a non-affine homography and inverse mapping.
  • undistort: nonzero radial distortion and zero-distortion identity.
  • interp2d: pixel coordinates and an explicit input domain.

The expected pixels come from the ramp formulas rather than calling the same OpenCV operations in the assertions. OpenCV checks allow 0.1 intensity-unit absolute error for interpolation differences; SciPy interpolation uses 1e-6. No production code changes.

Validation on Python 3.11:

  • 22 reshape tests passed on OpenCV 4.12.0.88 and 5.0.0.93.
  • Full suite on OpenCV 5: 959 passed, 97 skipped, 5 subtests passed.
  • Each new test failed under its corresponding deliberate mutation (shifted coordinates, ignored matrix, or ignored distortion). All mutations were restored before the final suite run.
  • Changed test file passes ruff and black.

The full suite was not run on OpenCV 4; only the reshape suite was run there.

@codacy-production

Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity · 0 duplication

Metric Results
Complexity 0
Duplication 0

View in Codacy

NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.

@petercorke petercorke left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is so needed, thank you!

@RoboX2020

Copy link
Copy Markdown
Contributor Author

Glad to hear it, Peter. These geometry paths deserved real coverage. Thanks for the quick look.

@petercorke
petercorke merged commit 890d805 into petercorke:main Oct 17, 2026
37 checks passed
@petercorke

Copy link
Copy Markdown
Owner

Thanks — warping and undistortion really needed geometry checks rather than smoke tests. Merged.

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.

test_image_reshape.py: warp/undistort/interp2d tests are empty stubs

2 participants