opencv/modules/python/src2
Vadim Levin 0c5d74ec1a
Merge pull request #24066 from VadimLevin:dev/vlevin/python-typing-register-dnn-layer
Python typing refinement for dnn_registerLayer/dnn_unregisterLayer functions #24066

This patch introduces typings generation for `dnn_registerLayer`/`dnn_unregisterLayer` manually defined in [`cv2/modules/dnn/misc/python/pyopencv_dnn.hpp`](https://github.com/opencv/opencv/blob/4.x/modules/dnn/misc/python/pyopencv_dnn.hpp)

Updates:

- Add `LayerProtocol` to `cv2/dnn/__init__.pyi`:

    ```python
    class LayerProtocol(Protocol):
        def __init__(
            self, params: dict[str, DictValue],
            blobs: typing.Sequence[cv2.typing.MatLike]
        ) -> None: ...

        def getMemoryShapes(
            self, inputs: typing.Sequence[typing.Sequence[int]]
        ) -> typing.Sequence[typing.Sequence[int]]: ...

        def forward(
            self, inputs: typing.Sequence[cv2.typing.MatLike]
        ) -> typing.Sequence[cv2.typing.MatLike]: ...
    ```

- Add `dnn_registerLayer` function to `cv2/__init__.pyi`:

    ```python
    def dnn_registerLayer(layerTypeName: str,
                          layerClass: typing.Type[LayerProtocol]) -> None: ...
    ```

- Add `dnn_unregisterLayer` function to `cv2/__init__.pyi`:

    ```python
    def dnn_unregisterLayer(layerTypeName: str) -> None: ...
    ```
### 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
- [ ] 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.
- [x] The feature is well documented and sample code can be built with the project CMake
2023-07-27 11:28:00 +03:00
..
typing_stubs_generation Merge pull request #24066 from VadimLevin:dev/vlevin/python-typing-register-dnn-layer 2023-07-27 11:28:00 +03:00
copy_typings_stubs_on_success.py Merge pull request #20370 from ddacw:stub-gen-next 2023-05-26 18:25:46 +03:00
cv2_convert.cpp fix: preserve NumPY writeable flag in output arguments 2023-07-19 17:22:10 +03:00
cv2_convert.hpp Merge pull request #23766 from TolyaTalamanov:at/segmentation-demo-desync 2023-06-13 18:06:19 +03:00
cv2_highgui.cpp Merge pull request #21182 from mshabunin:split-cv2cpp 2021-12-05 12:49:36 +00:00
cv2_highgui.hpp Merge pull request #21182 from mshabunin:split-cv2cpp 2021-12-05 12:49:36 +00:00
cv2_numpy.cpp Merge pull request #23691 from dkurt:pycv_float16_fixes 2023-05-26 18:56:21 +03:00
cv2_numpy.hpp Fixed most clang -Wextra-semi warnings 2022-09-27 18:06:46 -04:00
cv2_util.cpp Proposed solution for issue #23633 2023-05-17 23:06:59 +02:00
cv2_util.hpp Fixed tests execution with Python 2.7 2023-07-11 18:24:08 +03:00
cv2.cpp Merge pull request #23679 from dkurt:py_cv_type_macro 2023-05-25 15:54:41 +03:00
cv2.hpp Merge pull request #21182 from mshabunin:split-cv2cpp 2021-12-05 12:49:36 +00:00
gen2.py feat: add cuda_GpuMat to big types 2023-07-26 10:16:49 +03:00
hdr_parser.py fix: remove extra '/O' modifier for '/IO' arguments 2023-02-17 13:07:28 +03:00
pycompat.hpp Merge pull request #23702 from dkurt:py_rotated_rect 2023-06-22 15:09:53 +03:00
typing_stubs_generator.py Merge pull request #23801 from VadimLevin:dev/vlevin/python-stubs-api-refinement 2023-06-21 10:44:36 +03:00