mirror of
https://github.com/opencv/opencv.git
synced 2026-07-21 19:33:03 +04:00
Merge pull request #28621 from mvanhorn:osc/28528-fix-houghcircles-return-type
imgproc: fix HoughCircles Python return type to allow None #28621 ### Pull Request Readiness Checklist See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request - [x] I agree to contribute to the project under Apache 2 License. - [x] To the best of my knowledge, the proposed patch is not based on a code under GPL or another license that is incompatible with OpenCV - [x] The PR is proposed to the proper branch - [x] There is a reference to the original bug report and related work - [ ] There is accuracy test, performance test and test data in opencv_extra repository, if applicable Patch to opencv_extra has the same branch name. - [ ] The feature is well documented and sample code can be built with the project CMake ### Description Fixes https://github.com/opencv/opencv/issues/28528 `HoughCircles` returns `None` when no circles are found, but the auto-generated Python type stub declares the return type as `MatLike` without `None`. This causes type checkers (mypy/pyright) to miss potential `None` dereferences. **Fix:** Add `HoughCircles` to `NODES_TO_REFINE` in `api_refinement.py` using the existing `make_optional_none_return` helper - the same pattern already used for `imread` and `imdecode`. This contribution was developed with AI assistance (Claude Code).
This commit is contained in:
@@ -457,6 +457,9 @@ NODES_TO_REFINE = {
|
||||
SymbolName(("cv", "fisheye"), (), "initUndistortRectifyMap"): make_optional_arg("D"),
|
||||
SymbolName(("cv", ), (), "imread"): make_optional_none_return,
|
||||
SymbolName(("cv", ), (), "imdecode"): make_optional_none_return,
|
||||
SymbolName(("cv", ), (), "HoughCircles"): make_optional_none_return,
|
||||
SymbolName(("cv", ), (), "HoughLines"): make_optional_none_return,
|
||||
SymbolName(("cv", ), (), "HoughLinesP"): make_optional_none_return,
|
||||
# Fix for issue #28534: inRange should accept Scalar for lowerb and upperb
|
||||
SymbolName(("cv", ), (), "inRange"): make_matlike_or_scalar_arg("lowerb", "upperb"),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user