opencv-python icon indicating copy to clipboard operation
opencv-python copied to clipboard

Implement cv2.cuda.Filter type hints

Open btakita opened this issue 3 months ago • 1 comments

It seems that cv2.cuda.Filter is missing as a type.

So are some cuda methods such as:

  • cv2.cuda.warpAffine
  • cv2.cuda.createMorphologyFilter

btakita avatar Sep 16 '25 18:09 btakita

I built OpenCV with CUDA support and see the following cv2/cuda/init.pyi:614:

class Filter(cv2.Algorithm):
    # Functions
    @_typing.overload
    def apply(self, src: cv2.typing.MatLike, dst: cv2.typing.MatLike | None = ..., stream: Stream = ...) -> cv2.typing.MatLike: ...
    @_typing.overload
    def apply(self, src: GpuMat, dst: GpuMat | None = ..., stream: Stream = ...) -> GpuMat: ...
    @_typing.overload
    def apply(self, src: cv2.UMat, dst: cv2.UMat | None = ..., stream: Stream = ...) -> cv2.UMat: ...

cv2/cuda/init.pyi:1884:

@_typing.overload
def createMorphologyFilter(op: int, srcType: int, kernel: cv2.typing.MatLike, anchor: cv2.typing.Point = ..., iterations: int = ...) -> Filter: ...
@_typing.overload
def createMorphologyFilter(op: int, srcType: int, kernel: GpuMat, anchor: cv2.typing.Point = ..., iterations: int = ...) -> Filter: ...
@_typing.overload
def createMorphologyFilter(op: int, srcType: int, kernel: cv2.UMat, anchor: cv2.typing.Point = ..., iterations: int = ...) -> Filter: ...

asmorkalov avatar Sep 22 '25 06:09 asmorkalov