Skip to content

test: cover image warping and undistortion geometry - #139

Open
RoboX2020 wants to merge 1 commit into
petercorke:mainfrom
RoboX2020:test/image-reshape-warps
Open

RoboX2020 wants to merge 1 commit into
petercorke:mainfrom
RoboX2020:test/image-reshape-warps

Conversation

@RoboX2020

Copy link
Copy Markdown

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.

This branch has not been deployed

No deployments
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

1 participant