Expand integration & feature test coverage#27
Merged
Conversation
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
Adds three test groups around
CvCascadeClassifierandCvHaarEvaluator::Feature::calcto lift coverage on previously partially-tested paths. All new tests follow the project's Arrange / Act / Assert convention with comments per step.Changes
1. Multi-stage cascade integration test — test_integration.cpp
CvCascadeClassifier::trainwithnumStages=2,maxWeakCount=3,maxDepth=2, LBP / gentle boost.o_cvboostree.cpp(depth > 1), plus the inter-stage sample-weight update inboost.cpp.stage0.xml,cascade.xml,params.xmlare produced and the cascade is loadable by the publiccv::CascadeClassifier.2. HAAR feature-set integration variants — test_integration.cpp
HAAR CORE mode produces a usable cascade— exercises the diagonal/centred Haar branch inCvHaarEvaluator::generateFeatures.HAAR ALL mode produces a usable cascade— exercises the 45-degree rotated branch.3. Direct
CvHaarEvaluator::Feature::calctests — test_features.cppFeaturetype via a thinHaarFeatureProbe : public CvHaarEvaluatorsubclass.upright two-rect feature on a vertical-step image— explicit numeric expectation (−3200) on a known integral image.upright feature returns zero on a uniform image— sanity / balanced filter.upright three-rect feature uses rect[2] when its weight is non-zero— covers the conditional third-rectangle branch in the inlinecalc().tilted-feature branch reads the tilted integral image— drives thetilted ? _tilted : _sumbranch viaCV_TILTED_OFFSETSand asserts the rotated-rect area on an all-ones image (2·w·h = 32, documented in the test).<opencv2/imgproc.hpp>forcv::integral.Verification
Test-suite runtime ~26 s (was ~17 s; the extra time is the multi-stage integration test running both
numStages=2and the two additional HAAR variants).Coverage impact
Per-file highlights:
boost.cpp(boost loop)o_cvboostree.cpp(depth>1)Most of the integration changes only flip a small number of branches because the existing single-stage HAAR BASIC test already covers the bulk of haarfeatures.cpp; the direct
Feature::calctests give the largest line/branch lift in this MR.Risk
Test-only change. No production source modified. The
HaarFeatureProbesubclass merely re-exposes a protected nested type for white-box testing — it does not override any virtual methods.Checklist