Merge pull request #23927 from Avasam:partially-unknown-mat

Fix partially unknown Mat
This commit is contained in:
Alexander Smorkalov 2023-07-11 10:32:48 +03:00 committed by GitHub
commit 6ff5245cf2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,12 +1,18 @@
__all__ = []
import sys
import numpy as np
import cv2 as cv
from typing import TYPE_CHECKING, Any
# Type subscription is not possible in python 3.8
if TYPE_CHECKING:
_NDArray = np.ndarray[Any, np.dtype[np.generic]]
else:
_NDArray = np.ndarray
# NumPy documentation: https://numpy.org/doc/stable/user/basics.subclassing.html
class Mat(np.ndarray):
class Mat(_NDArray):
'''
cv.Mat wrapper for numpy array.