Repository navigation
test: raise coverage of ImageMultiview, ImageRegionFeatures and ImageLineFeatures - #220
Merged
Merged
Conversation
…LineFeatures ImageMultiview 14% to 99%, ImageRegionFeatures 47% to 95%, ImageLineFeatures 55% to 95%. The stereo tests use a synthetic pair with a known shift, the line tests use drawn lines with known (theta, rho), and the MSER tests build the feature object by hand because OpenCV 5 finds far fewer MSERs than OpenCV 4. Four bugs are recorded as strict xfail tests: stereo_simple returns outputs larger than its inputs, stereo_simple fails with an integer drange, indexing an MSERFeature with an int gives len 2, and str() of an empty MSERFeature raises. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 72 |
| Duplication | 0 |
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.
…test OpenCV 4 finds the whole of a flat image as two regions, OpenCV 5 finds none. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.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.
Summary
First of three changes to lift coverage of the
Image*.pymodules. This one covers the three smallest, least-covered modules:ImageMultiview.pyImageRegionFeatures.pyImageLineFeatures.pyThe tests check results against known answers:
tests/test_image_multiview.pyreplaces the emptyTODOstubs. The stereo pair is a random texture shifted by 8 pixels, sostereo_simple,stereo_BMandstereo_SGBMmust recover a disparity of 8, and a ZNCC of 1.DSI_refineis given exact parabolas, so it must return the sub-pixel peak (3.3).rectify_homographiesis given the fundamental matrix of a pure horizontal translation and must put corresponding points on one row.tests/test_image_line_features_hough.pydraws one horizontal and one vertical line, solinesmust find (theta, rho) = (pi/2, 50) and (0, 30),lines_pmust find the end points, and the accumulator peak must sit on the longest line.tests/test_image_region_features_extra.pybuilds anMSERFeatureby hand, because OpenCV 5 finds far fewer MSERs than OpenCV 4 on the same image (Issue 54). It tests indexing, printing and the OCR word filtering.Four bugs found while writing these are recorded as strict
xfailtests, not fixed here, so whoever fixes one has to remove its marker:stereo_simplereturns images 2*hw larger than its inputs, though its docstring says they are the same size.stereo_simplewith an integerdrangeraisesValueError, because the sliceright_arr[:, :-0]is empty.MSERFeaturewith an int,msers[0], gives an object whoselen()is 2, not 1.str()of anMSERFeaturewith no regions raisesIndexError.Also seen, not changed:
stereo_simpleon auint8image pads with NaN, which numpy turns into 0 with aRuntimeWarning, so the border is treated as black. The tests usefloat32images for that reason.Testing
pytest tests: 1689 passed, 33 skipped, 5 xfailed.black,ruff checkandmypyreport no issues. Nothing is mocked exceptpytesseractin the tests of the OCR word filtering (the real one runs too, wheretesseractis installed), and the matches object given torectify_homographies, which is a stand-in holding point arrays. Not run: CI on Windows or OpenCV 4 (CI will).This change was written with AI assistance (Claude Code) and the diff has been read by the maintainer.
🤖 Generated with Claude Code