__init__.pyi 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534
  1. __all__: list[str] = []
  2. import cv2
  3. import cv2.typing
  4. import numpy
  5. import sys
  6. import typing as _typing
  7. if sys.version_info >= (3, 8):
  8. from typing import Protocol
  9. else:
  10. from typing_extensions import Protocol
  11. # Enumerations
  12. DNN_BACKEND_DEFAULT: int
  13. DNN_BACKEND_HALIDE: int
  14. DNN_BACKEND_INFERENCE_ENGINE: int
  15. DNN_BACKEND_OPENCV: int
  16. DNN_BACKEND_VKCOM: int
  17. DNN_BACKEND_CUDA: int
  18. DNN_BACKEND_WEBNN: int
  19. DNN_BACKEND_TIMVX: int
  20. DNN_BACKEND_CANN: int
  21. Backend = int
  22. """One of [DNN_BACKEND_DEFAULT, DNN_BACKEND_HALIDE, DNN_BACKEND_INFERENCE_ENGINE, DNN_BACKEND_OPENCV, DNN_BACKEND_VKCOM, DNN_BACKEND_CUDA, DNN_BACKEND_WEBNN, DNN_BACKEND_TIMVX, DNN_BACKEND_CANN]"""
  23. DNN_TARGET_CPU: int
  24. DNN_TARGET_OPENCL: int
  25. DNN_TARGET_OPENCL_FP16: int
  26. DNN_TARGET_MYRIAD: int
  27. DNN_TARGET_VULKAN: int
  28. DNN_TARGET_FPGA: int
  29. DNN_TARGET_CUDA: int
  30. DNN_TARGET_CUDA_FP16: int
  31. DNN_TARGET_HDDL: int
  32. DNN_TARGET_NPU: int
  33. DNN_TARGET_CPU_FP16: int
  34. Target = int
  35. """One of [DNN_TARGET_CPU, DNN_TARGET_OPENCL, DNN_TARGET_OPENCL_FP16, DNN_TARGET_MYRIAD, DNN_TARGET_VULKAN, DNN_TARGET_FPGA, DNN_TARGET_CUDA, DNN_TARGET_CUDA_FP16, DNN_TARGET_HDDL, DNN_TARGET_NPU, DNN_TARGET_CPU_FP16]"""
  36. DNN_LAYOUT_UNKNOWN: int
  37. DNN_LAYOUT_ND: int
  38. DNN_LAYOUT_NCHW: int
  39. DNN_LAYOUT_NCDHW: int
  40. DNN_LAYOUT_NHWC: int
  41. DNN_LAYOUT_NDHWC: int
  42. DNN_LAYOUT_PLANAR: int
  43. DataLayout = int
  44. """One of [DNN_LAYOUT_UNKNOWN, DNN_LAYOUT_ND, DNN_LAYOUT_NCHW, DNN_LAYOUT_NCDHW, DNN_LAYOUT_NHWC, DNN_LAYOUT_NDHWC, DNN_LAYOUT_PLANAR]"""
  45. DNN_PMODE_NULL: int
  46. DNN_PMODE_CROP_CENTER: int
  47. DNN_PMODE_LETTERBOX: int
  48. ImagePaddingMode = int
  49. """One of [DNN_PMODE_NULL, DNN_PMODE_CROP_CENTER, DNN_PMODE_LETTERBOX]"""
  50. SoftNMSMethod_SOFTNMS_LINEAR: int
  51. SOFT_NMSMETHOD_SOFTNMS_LINEAR: int
  52. SoftNMSMethod_SOFTNMS_GAUSSIAN: int
  53. SOFT_NMSMETHOD_SOFTNMS_GAUSSIAN: int
  54. SoftNMSMethod = int
  55. """One of [SoftNMSMethod_SOFTNMS_LINEAR, SOFT_NMSMETHOD_SOFTNMS_LINEAR, SoftNMSMethod_SOFTNMS_GAUSSIAN, SOFT_NMSMETHOD_SOFTNMS_GAUSSIAN]"""
  56. # Classes
  57. class DictValue:
  58. # Functions
  59. @_typing.overload
  60. def __init__(self, i: int) -> None: ...
  61. @_typing.overload
  62. def __init__(self, p: float) -> None: ...
  63. @_typing.overload
  64. def __init__(self, s: str) -> None: ...
  65. def isInt(self) -> bool: ...
  66. def isString(self) -> bool: ...
  67. def isReal(self) -> bool: ...
  68. def getIntValue(self, idx: int = ...) -> int: ...
  69. def getRealValue(self, idx: int = ...) -> float: ...
  70. def getStringValue(self, idx: int = ...) -> str: ...
  71. class Layer(cv2.Algorithm):
  72. blobs: _typing.Sequence[cv2.typing.MatLike]
  73. @property
  74. def name(self) -> str: ...
  75. @property
  76. def type(self) -> str: ...
  77. @property
  78. def preferableTarget(self) -> int: ...
  79. # Functions
  80. @_typing.overload
  81. def finalize(self, inputs: _typing.Sequence[cv2.typing.MatLike], outputs: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  82. @_typing.overload
  83. def finalize(self, inputs: _typing.Sequence[cv2.UMat], outputs: _typing.Sequence[cv2.UMat] | None = ...) -> _typing.Sequence[cv2.UMat]: ...
  84. def run(self, inputs: _typing.Sequence[cv2.typing.MatLike], internals: _typing.Sequence[cv2.typing.MatLike], outputs: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> tuple[_typing.Sequence[cv2.typing.MatLike], _typing.Sequence[cv2.typing.MatLike]]: ...
  85. def outputNameToIndex(self, outputName: str) -> int: ...
  86. class Net:
  87. # Functions
  88. def __init__(self) -> None: ...
  89. @classmethod
  90. @_typing.overload
  91. def readFromModelOptimizer(cls, xml: str, bin: str) -> Net: ...
  92. @classmethod
  93. @_typing.overload
  94. def readFromModelOptimizer(cls, bufferModelConfig: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferWeights: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]]) -> Net: ...
  95. def empty(self) -> bool: ...
  96. def dump(self) -> str: ...
  97. def dumpToFile(self, path: str) -> None: ...
  98. def dumpToPbtxt(self, path: str) -> None: ...
  99. def addLayer(self, name: str, type: str, dtype: int, params: cv2.typing.LayerParams) -> int: ...
  100. def addLayerToPrev(self, name: str, type: str, dtype: int, params: cv2.typing.LayerParams) -> int: ...
  101. def getLayerId(self, layer: str) -> int: ...
  102. def getLayerNames(self) -> _typing.Sequence[str]: ...
  103. @_typing.overload
  104. def getLayer(self, layerId: int) -> Layer: ...
  105. @_typing.overload
  106. def getLayer(self, layerName: str) -> Layer: ...
  107. @_typing.overload
  108. def getLayer(self, layerId: cv2.typing.LayerId) -> Layer: ...
  109. def connect(self, outPin: str, inpPin: str) -> None: ...
  110. def setInputsNames(self, inputBlobNames: _typing.Sequence[str]) -> None: ...
  111. def setInputShape(self, inputName: str, shape: cv2.typing.MatShape) -> None: ...
  112. @_typing.overload
  113. def forward(self, outputName: str = ...) -> cv2.typing.MatLike: ...
  114. @_typing.overload
  115. def forward(self, outputBlobs: _typing.Sequence[cv2.typing.MatLike] | None = ..., outputName: str = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  116. @_typing.overload
  117. def forward(self, outputBlobs: _typing.Sequence[cv2.UMat] | None = ..., outputName: str = ...) -> _typing.Sequence[cv2.UMat]: ...
  118. @_typing.overload
  119. def forward(self, outBlobNames: _typing.Sequence[str], outputBlobs: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  120. @_typing.overload
  121. def forward(self, outBlobNames: _typing.Sequence[str], outputBlobs: _typing.Sequence[cv2.UMat] | None = ...) -> _typing.Sequence[cv2.UMat]: ...
  122. def forwardAsync(self, outputName: str = ...) -> cv2.AsyncArray: ...
  123. def forwardAndRetrieve(self, outBlobNames: _typing.Sequence[str]) -> _typing.Sequence[_typing.Sequence[cv2.typing.MatLike]]: ...
  124. @_typing.overload
  125. def quantize(self, calibData: _typing.Sequence[cv2.typing.MatLike], inputsDtype: int, outputsDtype: int, perChannel: bool = ...) -> Net: ...
  126. @_typing.overload
  127. def quantize(self, calibData: _typing.Sequence[cv2.UMat], inputsDtype: int, outputsDtype: int, perChannel: bool = ...) -> Net: ...
  128. def getInputDetails(self) -> tuple[_typing.Sequence[float], _typing.Sequence[int]]: ...
  129. def getOutputDetails(self) -> tuple[_typing.Sequence[float], _typing.Sequence[int]]: ...
  130. def setHalideScheduler(self, scheduler: str) -> None: ...
  131. def setPreferableBackend(self, backendId: int) -> None: ...
  132. def setPreferableTarget(self, targetId: int) -> None: ...
  133. @_typing.overload
  134. def setInput(self, blob: cv2.typing.MatLike, name: str = ..., scalefactor: float = ..., mean: cv2.typing.Scalar = ...) -> None: ...
  135. @_typing.overload
  136. def setInput(self, blob: cv2.UMat, name: str = ..., scalefactor: float = ..., mean: cv2.typing.Scalar = ...) -> None: ...
  137. @_typing.overload
  138. def setParam(self, layer: int, numParam: int, blob: cv2.typing.MatLike) -> None: ...
  139. @_typing.overload
  140. def setParam(self, layerName: str, numParam: int, blob: cv2.typing.MatLike) -> None: ...
  141. @_typing.overload
  142. def getParam(self, layer: int, numParam: int = ...) -> cv2.typing.MatLike: ...
  143. @_typing.overload
  144. def getParam(self, layerName: str, numParam: int = ...) -> cv2.typing.MatLike: ...
  145. def getUnconnectedOutLayers(self) -> _typing.Sequence[int]: ...
  146. def getUnconnectedOutLayersNames(self) -> _typing.Sequence[str]: ...
  147. @_typing.overload
  148. def getLayersShapes(self, netInputShapes: _typing.Sequence[cv2.typing.MatShape]) -> tuple[_typing.Sequence[int], _typing.Sequence[_typing.Sequence[cv2.typing.MatShape]], _typing.Sequence[_typing.Sequence[cv2.typing.MatShape]]]: ...
  149. @_typing.overload
  150. def getLayersShapes(self, netInputShape: cv2.typing.MatShape) -> tuple[_typing.Sequence[int], _typing.Sequence[_typing.Sequence[cv2.typing.MatShape]], _typing.Sequence[_typing.Sequence[cv2.typing.MatShape]]]: ...
  151. @_typing.overload
  152. def getFLOPS(self, netInputShapes: _typing.Sequence[cv2.typing.MatShape]) -> int: ...
  153. @_typing.overload
  154. def getFLOPS(self, netInputShape: cv2.typing.MatShape) -> int: ...
  155. @_typing.overload
  156. def getFLOPS(self, layerId: int, netInputShapes: _typing.Sequence[cv2.typing.MatShape]) -> int: ...
  157. @_typing.overload
  158. def getFLOPS(self, layerId: int, netInputShape: cv2.typing.MatShape) -> int: ...
  159. def getLayerTypes(self) -> _typing.Sequence[str]: ...
  160. def getLayersCount(self, layerType: str) -> int: ...
  161. @_typing.overload
  162. def getMemoryConsumption(self, netInputShape: cv2.typing.MatShape) -> tuple[int, int]: ...
  163. @_typing.overload
  164. def getMemoryConsumption(self, layerId: int, netInputShapes: _typing.Sequence[cv2.typing.MatShape]) -> tuple[int, int]: ...
  165. @_typing.overload
  166. def getMemoryConsumption(self, layerId: int, netInputShape: cv2.typing.MatShape) -> tuple[int, int]: ...
  167. def enableFusion(self, fusion: bool) -> None: ...
  168. def enableWinograd(self, useWinograd: bool) -> None: ...
  169. def getPerfProfile(self) -> tuple[int, _typing.Sequence[float]]: ...
  170. class Image2BlobParams:
  171. scalefactor: cv2.typing.Scalar
  172. size: cv2.typing.Size
  173. mean: cv2.typing.Scalar
  174. swapRB: bool
  175. ddepth: int
  176. datalayout: DataLayout
  177. paddingmode: ImagePaddingMode
  178. borderValue: cv2.typing.Scalar
  179. # Functions
  180. @_typing.overload
  181. def __init__(self) -> None: ...
  182. @_typing.overload
  183. def __init__(self, scalefactor: cv2.typing.Scalar, size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., ddepth: int = ..., datalayout: DataLayout = ..., mode: ImagePaddingMode = ..., borderValue: cv2.typing.Scalar = ...) -> None: ...
  184. def blobRectToImageRect(self, rBlob: cv2.typing.Rect, size: cv2.typing.Size) -> cv2.typing.Rect: ...
  185. def blobRectsToImageRects(self, rBlob: _typing.Sequence[cv2.typing.Rect], size: cv2.typing.Size) -> _typing.Sequence[cv2.typing.Rect]: ...
  186. class Model:
  187. # Functions
  188. @_typing.overload
  189. def __init__(self, model: str, config: str = ...) -> None: ...
  190. @_typing.overload
  191. def __init__(self, network: Net) -> None: ...
  192. @_typing.overload
  193. def setInputSize(self, size: cv2.typing.Size) -> Model: ...
  194. @_typing.overload
  195. def setInputSize(self, width: int, height: int) -> Model: ...
  196. def setInputMean(self, mean: cv2.typing.Scalar) -> Model: ...
  197. def setInputScale(self, scale: cv2.typing.Scalar) -> Model: ...
  198. def setInputCrop(self, crop: bool) -> Model: ...
  199. def setInputSwapRB(self, swapRB: bool) -> Model: ...
  200. def setOutputNames(self, outNames: _typing.Sequence[str]) -> Model: ...
  201. def setInputParams(self, scale: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ...) -> None: ...
  202. @_typing.overload
  203. def predict(self, frame: cv2.typing.MatLike, outs: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  204. @_typing.overload
  205. def predict(self, frame: cv2.UMat, outs: _typing.Sequence[cv2.UMat] | None = ...) -> _typing.Sequence[cv2.UMat]: ...
  206. def setPreferableBackend(self, backendId: Backend) -> Model: ...
  207. def setPreferableTarget(self, targetId: Target) -> Model: ...
  208. def enableWinograd(self, useWinograd: bool) -> Model: ...
  209. class ClassificationModel(Model):
  210. # Functions
  211. @_typing.overload
  212. def __init__(self, model: str, config: str = ...) -> None: ...
  213. @_typing.overload
  214. def __init__(self, network: Net) -> None: ...
  215. def setEnableSoftmaxPostProcessing(self, enable: bool) -> ClassificationModel: ...
  216. def getEnableSoftmaxPostProcessing(self) -> bool: ...
  217. @_typing.overload
  218. def classify(self, frame: cv2.typing.MatLike) -> tuple[int, float]: ...
  219. @_typing.overload
  220. def classify(self, frame: cv2.UMat) -> tuple[int, float]: ...
  221. class KeypointsModel(Model):
  222. # Functions
  223. @_typing.overload
  224. def __init__(self, model: str, config: str = ...) -> None: ...
  225. @_typing.overload
  226. def __init__(self, network: Net) -> None: ...
  227. @_typing.overload
  228. def estimate(self, frame: cv2.typing.MatLike, thresh: float = ...) -> _typing.Sequence[cv2.typing.Point2f]: ...
  229. @_typing.overload
  230. def estimate(self, frame: cv2.UMat, thresh: float = ...) -> _typing.Sequence[cv2.typing.Point2f]: ...
  231. class SegmentationModel(Model):
  232. # Functions
  233. @_typing.overload
  234. def __init__(self, model: str, config: str = ...) -> None: ...
  235. @_typing.overload
  236. def __init__(self, network: Net) -> None: ...
  237. @_typing.overload
  238. def segment(self, frame: cv2.typing.MatLike, mask: cv2.typing.MatLike | None = ...) -> cv2.typing.MatLike: ...
  239. @_typing.overload
  240. def segment(self, frame: cv2.UMat, mask: cv2.UMat | None = ...) -> cv2.UMat: ...
  241. class DetectionModel(Model):
  242. # Functions
  243. @_typing.overload
  244. def __init__(self, model: str, config: str = ...) -> None: ...
  245. @_typing.overload
  246. def __init__(self, network: Net) -> None: ...
  247. def setNmsAcrossClasses(self, value: bool) -> DetectionModel: ...
  248. def getNmsAcrossClasses(self) -> bool: ...
  249. @_typing.overload
  250. def detect(self, frame: cv2.typing.MatLike, confThreshold: float = ..., nmsThreshold: float = ...) -> tuple[_typing.Sequence[int], _typing.Sequence[float], _typing.Sequence[cv2.typing.Rect]]: ...
  251. @_typing.overload
  252. def detect(self, frame: cv2.UMat, confThreshold: float = ..., nmsThreshold: float = ...) -> tuple[_typing.Sequence[int], _typing.Sequence[float], _typing.Sequence[cv2.typing.Rect]]: ...
  253. class TextRecognitionModel(Model):
  254. # Functions
  255. @_typing.overload
  256. def __init__(self, network: Net) -> None: ...
  257. @_typing.overload
  258. def __init__(self, model: str, config: str = ...) -> None: ...
  259. def setDecodeType(self, decodeType: str) -> TextRecognitionModel: ...
  260. def getDecodeType(self) -> str: ...
  261. def setDecodeOptsCTCPrefixBeamSearch(self, beamSize: int, vocPruneSize: int = ...) -> TextRecognitionModel: ...
  262. def setVocabulary(self, vocabulary: _typing.Sequence[str]) -> TextRecognitionModel: ...
  263. def getVocabulary(self) -> _typing.Sequence[str]: ...
  264. @_typing.overload
  265. def recognize(self, frame: cv2.typing.MatLike) -> str: ...
  266. @_typing.overload
  267. def recognize(self, frame: cv2.UMat) -> str: ...
  268. @_typing.overload
  269. def recognize(self, frame: cv2.typing.MatLike, roiRects: _typing.Sequence[cv2.typing.MatLike]) -> _typing.Sequence[str]: ...
  270. @_typing.overload
  271. def recognize(self, frame: cv2.UMat, roiRects: _typing.Sequence[cv2.UMat]) -> _typing.Sequence[str]: ...
  272. class TextDetectionModel(Model):
  273. # Functions
  274. @_typing.overload
  275. def detect(self, frame: cv2.typing.MatLike) -> tuple[_typing.Sequence[_typing.Sequence[cv2.typing.Point]], _typing.Sequence[float]]: ...
  276. @_typing.overload
  277. def detect(self, frame: cv2.UMat) -> tuple[_typing.Sequence[_typing.Sequence[cv2.typing.Point]], _typing.Sequence[float]]: ...
  278. @_typing.overload
  279. def detect(self, frame: cv2.typing.MatLike) -> _typing.Sequence[_typing.Sequence[cv2.typing.Point]]: ...
  280. @_typing.overload
  281. def detect(self, frame: cv2.UMat) -> _typing.Sequence[_typing.Sequence[cv2.typing.Point]]: ...
  282. @_typing.overload
  283. def detectTextRectangles(self, frame: cv2.typing.MatLike) -> tuple[_typing.Sequence[cv2.typing.RotatedRect], _typing.Sequence[float]]: ...
  284. @_typing.overload
  285. def detectTextRectangles(self, frame: cv2.UMat) -> tuple[_typing.Sequence[cv2.typing.RotatedRect], _typing.Sequence[float]]: ...
  286. @_typing.overload
  287. def detectTextRectangles(self, frame: cv2.typing.MatLike) -> _typing.Sequence[cv2.typing.RotatedRect]: ...
  288. @_typing.overload
  289. def detectTextRectangles(self, frame: cv2.UMat) -> _typing.Sequence[cv2.typing.RotatedRect]: ...
  290. class TextDetectionModel_EAST(TextDetectionModel):
  291. # Functions
  292. @_typing.overload
  293. def __init__(self, network: Net) -> None: ...
  294. @_typing.overload
  295. def __init__(self, model: str, config: str = ...) -> None: ...
  296. def setConfidenceThreshold(self, confThreshold: float) -> TextDetectionModel_EAST: ...
  297. def getConfidenceThreshold(self) -> float: ...
  298. def setNMSThreshold(self, nmsThreshold: float) -> TextDetectionModel_EAST: ...
  299. def getNMSThreshold(self) -> float: ...
  300. class TextDetectionModel_DB(TextDetectionModel):
  301. # Functions
  302. @_typing.overload
  303. def __init__(self, network: Net) -> None: ...
  304. @_typing.overload
  305. def __init__(self, model: str, config: str = ...) -> None: ...
  306. def setBinaryThreshold(self, binaryThreshold: float) -> TextDetectionModel_DB: ...
  307. def getBinaryThreshold(self) -> float: ...
  308. def setPolygonThreshold(self, polygonThreshold: float) -> TextDetectionModel_DB: ...
  309. def getPolygonThreshold(self) -> float: ...
  310. def setUnclipRatio(self, unclipRatio: float) -> TextDetectionModel_DB: ...
  311. def getUnclipRatio(self) -> float: ...
  312. def setMaxCandidates(self, maxCandidates: int) -> TextDetectionModel_DB: ...
  313. def getMaxCandidates(self) -> int: ...
  314. class LayerProtocol(Protocol):
  315. # Functions
  316. def __init__(self, params: dict[str, DictValue], blobs: _typing.Sequence[cv2.typing.MatLike]) -> None: ...
  317. def getMemoryShapes(self, inputs: _typing.Sequence[_typing.Sequence[int]]) -> _typing.Sequence[_typing.Sequence[int]]: ...
  318. def forward(self, inputs: _typing.Sequence[cv2.typing.MatLike]) -> _typing.Sequence[cv2.typing.MatLike]: ...
  319. # Functions
  320. def NMSBoxes(bboxes: _typing.Sequence[cv2.typing.Rect2d], scores: _typing.Sequence[float], score_threshold: float, nms_threshold: float, eta: float = ..., top_k: int = ...) -> _typing.Sequence[int]: ...
  321. def NMSBoxesBatched(bboxes: _typing.Sequence[cv2.typing.Rect2d], scores: _typing.Sequence[float], class_ids: _typing.Sequence[int], score_threshold: float, nms_threshold: float, eta: float = ..., top_k: int = ...) -> _typing.Sequence[int]: ...
  322. def NMSBoxesRotated(bboxes: _typing.Sequence[cv2.typing.RotatedRect], scores: _typing.Sequence[float], score_threshold: float, nms_threshold: float, eta: float = ..., top_k: int = ...) -> _typing.Sequence[int]: ...
  323. @_typing.overload
  324. def blobFromImage(image: cv2.typing.MatLike, scalefactor: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ..., ddepth: int = ...) -> cv2.typing.MatLike: ...
  325. @_typing.overload
  326. def blobFromImage(image: cv2.UMat, scalefactor: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ..., ddepth: int = ...) -> cv2.typing.MatLike: ...
  327. @_typing.overload
  328. def blobFromImageWithParams(image: cv2.typing.MatLike, param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  329. @_typing.overload
  330. def blobFromImageWithParams(image: cv2.UMat, param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  331. @_typing.overload
  332. def blobFromImageWithParams(image: cv2.typing.MatLike, blob: cv2.typing.MatLike | None = ..., param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  333. @_typing.overload
  334. def blobFromImageWithParams(image: cv2.UMat, blob: cv2.UMat | None = ..., param: Image2BlobParams = ...) -> cv2.UMat: ...
  335. @_typing.overload
  336. def blobFromImages(images: _typing.Sequence[cv2.typing.MatLike], scalefactor: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ..., ddepth: int = ...) -> cv2.typing.MatLike: ...
  337. @_typing.overload
  338. def blobFromImages(images: _typing.Sequence[cv2.UMat], scalefactor: float = ..., size: cv2.typing.Size = ..., mean: cv2.typing.Scalar = ..., swapRB: bool = ..., crop: bool = ..., ddepth: int = ...) -> cv2.typing.MatLike: ...
  339. @_typing.overload
  340. def blobFromImagesWithParams(images: _typing.Sequence[cv2.typing.MatLike], param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  341. @_typing.overload
  342. def blobFromImagesWithParams(images: _typing.Sequence[cv2.UMat], param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  343. @_typing.overload
  344. def blobFromImagesWithParams(images: _typing.Sequence[cv2.typing.MatLike], blob: cv2.typing.MatLike | None = ..., param: Image2BlobParams = ...) -> cv2.typing.MatLike: ...
  345. @_typing.overload
  346. def blobFromImagesWithParams(images: _typing.Sequence[cv2.UMat], blob: cv2.UMat | None = ..., param: Image2BlobParams = ...) -> cv2.UMat: ...
  347. def getAvailableTargets(be: Backend) -> _typing.Sequence[Target]: ...
  348. @_typing.overload
  349. def imagesFromBlob(blob_: cv2.typing.MatLike, images_: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> _typing.Sequence[cv2.typing.MatLike]: ...
  350. @_typing.overload
  351. def imagesFromBlob(blob_: cv2.typing.MatLike, images_: _typing.Sequence[cv2.UMat] | None = ...) -> _typing.Sequence[cv2.UMat]: ...
  352. @_typing.overload
  353. def readNet(model: str, config: str = ..., framework: str = ...) -> Net: ...
  354. @_typing.overload
  355. def readNet(framework: str, bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferConfig: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]] = ...) -> Net: ...
  356. @_typing.overload
  357. def readNetFromCaffe(prototxt: str, caffeModel: str = ...) -> Net: ...
  358. @_typing.overload
  359. def readNetFromCaffe(bufferProto: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]] = ...) -> Net: ...
  360. @_typing.overload
  361. def readNetFromDarknet(cfgFile: str, darknetModel: str = ...) -> Net: ...
  362. @_typing.overload
  363. def readNetFromDarknet(bufferCfg: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]] = ...) -> Net: ...
  364. @_typing.overload
  365. def readNetFromModelOptimizer(xml: str, bin: str = ...) -> Net: ...
  366. @_typing.overload
  367. def readNetFromModelOptimizer(bufferModelConfig: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferWeights: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]]) -> Net: ...
  368. @_typing.overload
  369. def readNetFromONNX(onnxFile: str) -> Net: ...
  370. @_typing.overload
  371. def readNetFromONNX(buffer: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]]) -> Net: ...
  372. @_typing.overload
  373. def readNetFromTFLite(model: str) -> Net: ...
  374. @_typing.overload
  375. def readNetFromTFLite(bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]]) -> Net: ...
  376. @_typing.overload
  377. def readNetFromTensorflow(model: str, config: str = ...) -> Net: ...
  378. @_typing.overload
  379. def readNetFromTensorflow(bufferModel: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]], bufferConfig: numpy.ndarray[_typing.Any, numpy.dtype[numpy.uint8]] = ...) -> Net: ...
  380. def readNetFromTorch(model: str, isBinary: bool = ..., evaluate: bool = ...) -> Net: ...
  381. def readTensorFromONNX(path: str) -> cv2.typing.MatLike: ...
  382. def readTorchBlob(filename: str, isBinary: bool = ...) -> cv2.typing.MatLike: ...
  383. def shrinkCaffeModel(src: str, dst: str, layersTypes: _typing.Sequence[str] = ...) -> None: ...
  384. def softNMSBoxes(bboxes: _typing.Sequence[cv2.typing.Rect], scores: _typing.Sequence[float], score_threshold: float, nms_threshold: float, top_k: int = ..., sigma: float = ..., method: SoftNMSMethod = ...) -> tuple[_typing.Sequence[float], _typing.Sequence[int]]: ...
  385. def writeTextGraph(model: str, output: str) -> None: ...