Skip to content

fix: mark Feature2D.detectAndCompute mask as optional in Python type stubs#27544

Merged
asmorkalov merged 1 commit intoopencv:4.xfrom
inventshah:fix-detect-and-compute-py-type
Jul 15, 2025
Merged

fix: mark Feature2D.detectAndCompute mask as optional in Python type stubs#27544
asmorkalov merged 1 commit intoopencv:4.xfrom
inventshah:fix-detect-and-compute-py-type

Conversation

@inventshah
Copy link
Copy Markdown
Contributor

Fixes #27543.

Before patch

@_typing.overload
def detectAndCompute(
    self,
    image: cv2.typing.MatLike,
    mask: cv2.typing.MatLike,
    descriptors: cv2.typing.MatLike | None = ...,
    useProvidedKeypoints: bool = ...,
) -> tuple[_typing.Sequence[KeyPoint], cv2.typing.MatLike]: ...
@_typing.overload
def detectAndCompute(
    self,
    image: UMat,
    mask: UMat,
    descriptors: UMat | None = ...,
    useProvidedKeypoints: bool = ...,
) -> tuple[_typing.Sequence[KeyPoint], UMat]: ...

After patch

@_typing.overload
def detectAndCompute(
    self,
    image: cv2.typing.MatLike,
    mask: cv2.typing.MatLike | None,
    descriptors: cv2.typing.MatLike | None = ...,
    useProvidedKeypoints: bool = ...,
) -> tuple[_typing.Sequence[KeyPoint], cv2.typing.MatLike]: ...
@_typing.overload
def detectAndCompute(
    self,
    image: UMat,
    mask: UMat | None,
    descriptors: UMat | None = ...,
    useProvidedKeypoints: bool = ...,
) -> tuple[_typing.Sequence[KeyPoint], UMat]: ...

Pull Request Readiness Checklist

See details at https://github.com/opencv/opencv/wiki/How_to_contribute#making-a-good-pull-request

  • I agree to contribute to the project under Apache 2 License.
  • 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
  • The PR is proposed to the proper branch
  • 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

@asmorkalov asmorkalov requested a review from VadimLevin July 15, 2025 05:41
@asmorkalov asmorkalov self-assigned this Jul 15, 2025
@asmorkalov asmorkalov added this to the 4.13.0 milestone Jul 15, 2025
@asmorkalov asmorkalov merged commit f734de0 into opencv:4.x Jul 15, 2025
52 of 55 checks passed
@inventshah inventshah deleted the fix-detect-and-compute-py-type branch July 15, 2025 14:28
@asmorkalov asmorkalov mentioned this pull request Jul 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature2D.detectAndCompute mask argument is missing | None in type stubs

2 participants