Derive the hand-written overrides from the generator#96
Merged
Conversation
The three files under src/overrides/ existed to paper over gaps in the
wrapper generator. Each gap is now closed in the generator itself, so the
overrides are deleted and their behaviour is produced by `regenerate.jl`.
- Covariance (deletes covariance.jl): gen3_julia_cxx.py now emits the
covariant `AbstractVector{<:InputArray}` for vector-of-array parameters
instead of the invariant `Array{InputArray, 1}`, so a natural
`Vector{Array{Float32,3}}` dispatches without an `InputArray[…]` cast.
The relaxation is applied to the type annotation only; default-value
lookups still key off the unrelaxed type (issues #18, #60).
- Defaults (deletes defaults.jl): six defval.txt entries let the generator
emit the keyword-default overloads for ORB_create and
SimpleBlobDetector_create. Note: ORB_create's `scoreType` now defaults to
the OpenCV-faithful ORB_HARRIS_SCORE; the override had hard-coded
ORB_FAST_SCORE, which was a bug.
- GUI/Cascade callbacks (moved out of convenience.jl): relocated to
gen/binding_templates_jl/manual_cxx.jl, emitted verbatim into
cv_cxx_wrap.jl as a "Manual Wrapping" section — the Julia counterpart of
the existing C++ block in cv_core.cpp. No C++/JLL change; the compiled
symbols already exist. Behaviour is preserved exactly.
- VideoWriter_fourcc string form: moved to the hand-written src/videoio.jl
(not an override).
src/overrides/ is removed. The #60 calibrate hasmethod tests are updated to
the generated keyword-form arity (preserving their concrete-element intent),
and stale comments in README.md / test_imgproc.jl are corrected.
Regeneration stays deterministic; the full suite passes (310/310).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #96 +/- ##
==========================================
+ Coverage 84.67% 91.45% +6.78%
==========================================
Files 13 11 -2
Lines 274 234 -40
==========================================
- Hits 232 214 -18
+ Misses 42 20 -22 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Motivation
The three files under
src/overrides/existed only to paper over gaps in the wrapper generator. Since OpenCV.jl already owns its fork of the Julia-specific generator (the upstreamopencv_contribcopy is effectively unmaintained), the lower-risk home for this logic is the generator itself. Each gap is now closed there, the overrides are deleted, and their behaviour is produced byjulia gen/regenerate.jl.Net: −156 / +54 lines of hand-maintained code;
src/overrides/is gone.Changes
Covariance — deletes
covariance.jl(62 lines).gen3_julia_cxx.pyemits the covariantAbstractVector{<:InputArray}for vector-of-array parameters instead of the invariantArray{InputArray, 1}, so a naturalVector{Array{Float32,3}}dispatches without anOpenCV.InputArray[…]cast. Applied to the type annotation only; default-value lookups still key off the unrelaxed type. (issues #18, #60)Defaults — deletes
defaults.jl(22 lines).Six
defval.txtentries let the generator emit the keyword-default overloads forORB_createandSimpleBlobDetector_create. The diff is surgical — only those two overloads appear.GUI / Cascade callbacks — moved out of
convenience.jl.Relocated to
gen/binding_templates_jl/manual_cxx.jl, emitted verbatim intocv_cxx_wrap.jlas a "Manual Wrapping" section — the Julia counterpart of the existing C++ block incv_core.cpp. No C++/JLL change (those symbols are already compiled); behaviour preserved exactly.VideoWriter_fourccstring form — moved to the hand-writtensrc/videoio.jl(not an override).ORB_create()'s defaultscoreTypeis now the OpenCV-faithfulORB_HARRIS_SCORE. The deleted override hard-codedORB_FAST_SCORE, which was a bug — but this does change descriptor behaviour for callers who relied on the implicit default.Caveat
The GUI callbacks (
createButton/setMouseCallback/createTrackbar) referencejl_cpp_cv2, which is defined nowhere and untested — they wouldUndefVarErrorif called. They are relocated with exact parity; fixing/removing them is left to separate work, since the highgui C++ side can't be rebuilt/tested here.Verification
julia gen/regenerate.jlis byte-for-byte idempotent → the CIgit diff --exit-codeguard stays green.#60calibrate*hasmethodtests are updated to the generated keyword-form arity (they previously asserted the override'sargs...reduced-arity shape), preserving their concrete-element-dispatch intent. Stalesrc/overrides//src/patches*.jlreferences inREADME.mdandtest_imgproc.jlare corrected.🤖 Generated with Claude Code