mirror of
https://github.com/opencv/opencv.git
synced 2025-06-09 10:40:46 +08:00
Merge pull request #23927 from Avasam:partially-unknown-mat
Fix partially unknown Mat
This commit is contained in:
commit
6ff5245cf2
@ -1,12 +1,18 @@
|
|||||||
__all__ = []
|
__all__ = []
|
||||||
|
|
||||||
import sys
|
|
||||||
import numpy as np
|
import numpy as np
|
||||||
import cv2 as cv
|
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
|
# NumPy documentation: https://numpy.org/doc/stable/user/basics.subclassing.html
|
||||||
|
|
||||||
class Mat(np.ndarray):
|
class Mat(_NDArray):
|
||||||
'''
|
'''
|
||||||
cv.Mat wrapper for numpy array.
|
cv.Mat wrapper for numpy array.
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user