__init__.pyi 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316
  1. __all__: list[str] = []
  2. import cv2
  3. import cv2.typing
  4. import typing as _typing
  5. # Enumerations
  6. CORNER_REFINE_NONE: int
  7. CORNER_REFINE_SUBPIX: int
  8. CORNER_REFINE_CONTOUR: int
  9. CORNER_REFINE_APRILTAG: int
  10. CornerRefineMethod = int
  11. """One of [CORNER_REFINE_NONE, CORNER_REFINE_SUBPIX, CORNER_REFINE_CONTOUR, CORNER_REFINE_APRILTAG]"""
  12. DICT_4X4_50: int
  13. DICT_4X4_100: int
  14. DICT_4X4_250: int
  15. DICT_4X4_1000: int
  16. DICT_5X5_50: int
  17. DICT_5X5_100: int
  18. DICT_5X5_250: int
  19. DICT_5X5_1000: int
  20. DICT_6X6_50: int
  21. DICT_6X6_100: int
  22. DICT_6X6_250: int
  23. DICT_6X6_1000: int
  24. DICT_7X7_50: int
  25. DICT_7X7_100: int
  26. DICT_7X7_250: int
  27. DICT_7X7_1000: int
  28. DICT_ARUCO_ORIGINAL: int
  29. DICT_APRILTAG_16h5: int
  30. DICT_APRILTAG_16H5: int
  31. DICT_APRILTAG_25h9: int
  32. DICT_APRILTAG_25H9: int
  33. DICT_APRILTAG_36h10: int
  34. DICT_APRILTAG_36H10: int
  35. DICT_APRILTAG_36h11: int
  36. DICT_APRILTAG_36H11: int
  37. DICT_ARUCO_MIP_36h12: int
  38. DICT_ARUCO_MIP_36H12: int
  39. PredefinedDictionaryType = int
  40. """One of [DICT_4X4_50, DICT_4X4_100, DICT_4X4_250, DICT_4X4_1000, DICT_5X5_50, DICT_5X5_100, DICT_5X5_250, DICT_5X5_1000, DICT_6X6_50, DICT_6X6_100, DICT_6X6_250, DICT_6X6_1000, DICT_7X7_50, DICT_7X7_100, DICT_7X7_250, DICT_7X7_1000, DICT_ARUCO_ORIGINAL, DICT_APRILTAG_16h5, DICT_APRILTAG_16H5, DICT_APRILTAG_25h9, DICT_APRILTAG_25H9, DICT_APRILTAG_36h10, DICT_APRILTAG_36H10, DICT_APRILTAG_36h11, DICT_APRILTAG_36H11, DICT_ARUCO_MIP_36h12, DICT_ARUCO_MIP_36H12]"""
  41. # Classes
  42. class Board:
  43. # Functions
  44. @_typing.overload
  45. def __init__(self, objPoints: _typing.Sequence[cv2.typing.MatLike], dictionary: Dictionary, ids: cv2.typing.MatLike) -> None: ...
  46. @_typing.overload
  47. def __init__(self, objPoints: _typing.Sequence[cv2.UMat], dictionary: Dictionary, ids: cv2.UMat) -> None: ...
  48. def getDictionary(self) -> Dictionary: ...
  49. def getObjPoints(self) -> _typing.Sequence[_typing.Sequence[cv2.typing.Point3f]]: ...
  50. def getIds(self) -> _typing.Sequence[int]: ...
  51. def getRightBottomCorner(self) -> cv2.typing.Point3f: ...
  52. @_typing.overload
  53. def matchImagePoints(self, detectedCorners: _typing.Sequence[cv2.typing.MatLike], detectedIds: cv2.typing.MatLike, objPoints: cv2.typing.MatLike | None = ..., imgPoints: cv2.typing.MatLike | None = ...) -> tuple[cv2.typing.MatLike, cv2.typing.MatLike]: ...
  54. @_typing.overload
  55. def matchImagePoints(self, detectedCorners: _typing.Sequence[cv2.UMat], detectedIds: cv2.UMat, objPoints: cv2.UMat | None = ..., imgPoints: cv2.UMat | None = ...) -> tuple[cv2.UMat, cv2.UMat]: ...
  56. @_typing.overload
  57. def generateImage(self, outSize: cv2.typing.Size, img: cv2.typing.MatLike | None = ..., marginSize: int = ..., borderBits: int = ...) -> cv2.typing.MatLike: ...
  58. @_typing.overload
  59. def generateImage(self, outSize: cv2.typing.Size, img: cv2.UMat | None = ..., marginSize: int = ..., borderBits: int = ...) -> cv2.UMat: ...
  60. class GridBoard(Board):
  61. # Functions
  62. @_typing.overload
  63. def __init__(self, size: cv2.typing.Size, markerLength: float, markerSeparation: float, dictionary: Dictionary, ids: cv2.typing.MatLike | None = ...) -> None: ...
  64. @_typing.overload
  65. def __init__(self, size: cv2.typing.Size, markerLength: float, markerSeparation: float, dictionary: Dictionary, ids: cv2.UMat | None = ...) -> None: ...
  66. def getGridSize(self) -> cv2.typing.Size: ...
  67. def getMarkerLength(self) -> float: ...
  68. def getMarkerSeparation(self) -> float: ...
  69. class CharucoBoard(Board):
  70. # Functions
  71. @_typing.overload
  72. def __init__(self, size: cv2.typing.Size, squareLength: float, markerLength: float, dictionary: Dictionary, ids: cv2.typing.MatLike | None = ...) -> None: ...
  73. @_typing.overload
  74. def __init__(self, size: cv2.typing.Size, squareLength: float, markerLength: float, dictionary: Dictionary, ids: cv2.UMat | None = ...) -> None: ...
  75. def setLegacyPattern(self, legacyPattern: bool) -> None: ...
  76. def getLegacyPattern(self) -> bool: ...
  77. def getChessboardSize(self) -> cv2.typing.Size: ...
  78. def getSquareLength(self) -> float: ...
  79. def getMarkerLength(self) -> float: ...
  80. def getChessboardCorners(self) -> _typing.Sequence[cv2.typing.Point3f]: ...
  81. @_typing.overload
  82. def checkCharucoCornersCollinear(self, charucoIds: cv2.typing.MatLike) -> bool: ...
  83. @_typing.overload
  84. def checkCharucoCornersCollinear(self, charucoIds: cv2.UMat) -> bool: ...
  85. class DetectorParameters:
  86. adaptiveThreshWinSizeMin: int
  87. adaptiveThreshWinSizeMax: int
  88. adaptiveThreshWinSizeStep: int
  89. adaptiveThreshConstant: float
  90. minMarkerPerimeterRate: float
  91. maxMarkerPerimeterRate: float
  92. polygonalApproxAccuracyRate: float
  93. minCornerDistanceRate: float
  94. minDistanceToBorder: int
  95. minMarkerDistanceRate: float
  96. minGroupDistance: float
  97. cornerRefinementMethod: int
  98. cornerRefinementWinSize: int
  99. relativeCornerRefinmentWinSize: float
  100. cornerRefinementMaxIterations: int
  101. cornerRefinementMinAccuracy: float
  102. markerBorderBits: int
  103. perspectiveRemovePixelPerCell: int
  104. perspectiveRemoveIgnoredMarginPerCell: float
  105. maxErroneousBitsInBorderRate: float
  106. minOtsuStdDev: float
  107. errorCorrectionRate: float
  108. aprilTagQuadDecimate: float
  109. aprilTagQuadSigma: float
  110. aprilTagMinClusterPixels: int
  111. aprilTagMaxNmaxima: int
  112. aprilTagCriticalRad: float
  113. aprilTagMaxLineFitMse: float
  114. aprilTagMinWhiteBlackDiff: int
  115. aprilTagDeglitch: int
  116. detectInvertedMarker: bool
  117. useAruco3Detection: bool
  118. minSideLengthCanonicalImg: int
  119. minMarkerLengthRatioOriginalImg: float
  120. # Functions
  121. def __init__(self) -> None: ...
  122. def readDetectorParameters(self, fn: cv2.FileNode) -> bool: ...
  123. def writeDetectorParameters(self, fs: cv2.FileStorage, name: str = ...) -> bool: ...
  124. class RefineParameters:
  125. minRepDistance: float
  126. errorCorrectionRate: float
  127. checkAllOrders: bool
  128. # Functions
  129. def __init__(self, minRepDistance: float = ..., errorCorrectionRate: float = ..., checkAllOrders: bool = ...) -> None: ...
  130. def readRefineParameters(self, fn: cv2.FileNode) -> bool: ...
  131. def writeRefineParameters(self, fs: cv2.FileStorage, name: str = ...) -> bool: ...
  132. class ArucoDetector(cv2.Algorithm):
  133. # Functions
  134. @_typing.overload
  135. def __init__(self, dictionary: Dictionary = ..., detectorParams: DetectorParameters = ..., refineParams: RefineParameters = ...) -> None: ...
  136. @_typing.overload
  137. def __init__(self, dictionaries: _typing.Sequence[Dictionary], detectorParams: DetectorParameters = ..., refineParams: RefineParameters = ...) -> None: ...
  138. @_typing.overload
  139. def detectMarkers(self, image: cv2.typing.MatLike, corners: _typing.Sequence[cv2.typing.MatLike] | None = ..., ids: cv2.typing.MatLike | None = ..., rejectedImgPoints: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> tuple[_typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike]]: ...
  140. @_typing.overload
  141. def detectMarkers(self, image: cv2.UMat, corners: _typing.Sequence[cv2.UMat] | None = ..., ids: cv2.UMat | None = ..., rejectedImgPoints: _typing.Sequence[cv2.UMat] | None = ...) -> tuple[_typing.Sequence[cv2.UMat], cv2.UMat, _typing.Sequence[cv2.UMat]]: ...
  142. @_typing.overload
  143. def refineDetectedMarkers(self, image: cv2.typing.MatLike, board: Board, detectedCorners: _typing.Sequence[cv2.typing.MatLike], detectedIds: cv2.typing.MatLike, rejectedCorners: _typing.Sequence[cv2.typing.MatLike], cameraMatrix: cv2.typing.MatLike | None = ..., distCoeffs: cv2.typing.MatLike | None = ..., recoveredIdxs: cv2.typing.MatLike | None = ...) -> tuple[_typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike]: ...
  144. @_typing.overload
  145. def refineDetectedMarkers(self, image: cv2.UMat, board: Board, detectedCorners: _typing.Sequence[cv2.UMat], detectedIds: cv2.UMat, rejectedCorners: _typing.Sequence[cv2.UMat], cameraMatrix: cv2.UMat | None = ..., distCoeffs: cv2.UMat | None = ..., recoveredIdxs: cv2.UMat | None = ...) -> tuple[_typing.Sequence[cv2.UMat], cv2.UMat, _typing.Sequence[cv2.UMat], cv2.UMat]: ...
  146. @_typing.overload
  147. def detectMarkersMultiDict(self, image: cv2.typing.MatLike, corners: _typing.Sequence[cv2.typing.MatLike] | None = ..., ids: cv2.typing.MatLike | None = ..., rejectedImgPoints: _typing.Sequence[cv2.typing.MatLike] | None = ..., dictIndices: cv2.typing.MatLike | None = ...) -> tuple[_typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike]: ...
  148. @_typing.overload
  149. def detectMarkersMultiDict(self, image: cv2.UMat, corners: _typing.Sequence[cv2.UMat] | None = ..., ids: cv2.UMat | None = ..., rejectedImgPoints: _typing.Sequence[cv2.UMat] | None = ..., dictIndices: cv2.UMat | None = ...) -> tuple[_typing.Sequence[cv2.UMat], cv2.UMat, _typing.Sequence[cv2.UMat], cv2.UMat]: ...
  150. def getDictionary(self) -> Dictionary: ...
  151. def setDictionary(self, dictionary: Dictionary) -> None: ...
  152. def getDictionaries(self) -> _typing.Sequence[Dictionary]: ...
  153. def setDictionaries(self, dictionaries: _typing.Sequence[Dictionary]) -> None: ...
  154. def getDetectorParameters(self) -> DetectorParameters: ...
  155. def setDetectorParameters(self, detectorParameters: DetectorParameters) -> None: ...
  156. def getRefineParameters(self) -> RefineParameters: ...
  157. def setRefineParameters(self, refineParameters: RefineParameters) -> None: ...
  158. def write(self, fs: cv2.FileStorage, name: str) -> None: ...
  159. def read(self, fn: cv2.FileNode) -> None: ...
  160. class Dictionary:
  161. bytesList: cv2.typing.MatLike
  162. markerSize: int
  163. maxCorrectionBits: int
  164. # Functions
  165. @_typing.overload
  166. def __init__(self) -> None: ...
  167. @_typing.overload
  168. def __init__(self, bytesList: cv2.typing.MatLike, _markerSize: int, maxcorr: int = ...) -> None: ...
  169. def readDictionary(self, fn: cv2.FileNode) -> bool: ...
  170. def writeDictionary(self, fs: cv2.FileStorage, name: str = ...) -> None: ...
  171. def identify(self, onlyBits: cv2.typing.MatLike, maxCorrectionRate: float) -> tuple[bool, int, int]: ...
  172. @_typing.overload
  173. def getDistanceToId(self, bits: cv2.typing.MatLike, id: int, allRotations: bool = ...) -> int: ...
  174. @_typing.overload
  175. def getDistanceToId(self, bits: cv2.UMat, id: int, allRotations: bool = ...) -> int: ...
  176. @_typing.overload
  177. def generateImageMarker(self, id: int, sidePixels: int, _img: cv2.typing.MatLike | None = ..., borderBits: int = ...) -> cv2.typing.MatLike: ...
  178. @_typing.overload
  179. def generateImageMarker(self, id: int, sidePixels: int, _img: cv2.UMat | None = ..., borderBits: int = ...) -> cv2.UMat: ...
  180. @staticmethod
  181. def getByteListFromBits(bits: cv2.typing.MatLike) -> cv2.typing.MatLike: ...
  182. @staticmethod
  183. def getBitsFromByteList(byteList: cv2.typing.MatLike, markerSize: int) -> cv2.typing.MatLike: ...
  184. class CharucoParameters:
  185. cameraMatrix: cv2.typing.MatLike
  186. distCoeffs: cv2.typing.MatLike
  187. minMarkers: int
  188. tryRefineMarkers: bool
  189. checkMarkers: bool
  190. # Functions
  191. def __init__(self) -> None: ...
  192. class CharucoDetector(cv2.Algorithm):
  193. # Functions
  194. def __init__(self, board: CharucoBoard, charucoParams: CharucoParameters = ..., detectorParams: DetectorParameters = ..., refineParams: RefineParameters = ...) -> None: ...
  195. def getBoard(self) -> CharucoBoard: ...
  196. def setBoard(self, board: CharucoBoard) -> None: ...
  197. def getCharucoParameters(self) -> CharucoParameters: ...
  198. def setCharucoParameters(self, charucoParameters: CharucoParameters) -> None: ...
  199. def getDetectorParameters(self) -> DetectorParameters: ...
  200. def setDetectorParameters(self, detectorParameters: DetectorParameters) -> None: ...
  201. def getRefineParameters(self) -> RefineParameters: ...
  202. def setRefineParameters(self, refineParameters: RefineParameters) -> None: ...
  203. @_typing.overload
  204. def detectBoard(self, image: cv2.typing.MatLike, charucoCorners: cv2.typing.MatLike | None = ..., charucoIds: cv2.typing.MatLike | None = ..., markerCorners: _typing.Sequence[cv2.typing.MatLike] | None = ..., markerIds: cv2.typing.MatLike | None = ...) -> tuple[cv2.typing.MatLike, cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike]: ...
  205. @_typing.overload
  206. def detectBoard(self, image: cv2.UMat, charucoCorners: cv2.UMat | None = ..., charucoIds: cv2.UMat | None = ..., markerCorners: _typing.Sequence[cv2.UMat] | None = ..., markerIds: cv2.UMat | None = ...) -> tuple[cv2.UMat, cv2.UMat, _typing.Sequence[cv2.UMat], cv2.UMat]: ...
  207. @_typing.overload
  208. def detectDiamonds(self, image: cv2.typing.MatLike, diamondCorners: _typing.Sequence[cv2.typing.MatLike] | None = ..., diamondIds: cv2.typing.MatLike | None = ..., markerCorners: _typing.Sequence[cv2.typing.MatLike] | None = ..., markerIds: cv2.typing.MatLike | None = ...) -> tuple[_typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike, _typing.Sequence[cv2.typing.MatLike], cv2.typing.MatLike]: ...
  209. @_typing.overload
  210. def detectDiamonds(self, image: cv2.UMat, diamondCorners: _typing.Sequence[cv2.UMat] | None = ..., diamondIds: cv2.UMat | None = ..., markerCorners: _typing.Sequence[cv2.UMat] | None = ..., markerIds: cv2.UMat | None = ...) -> tuple[_typing.Sequence[cv2.UMat], cv2.UMat, _typing.Sequence[cv2.UMat], cv2.UMat]: ...
  211. # Functions
  212. @_typing.overload
  213. def drawDetectedCornersCharuco(image: cv2.typing.MatLike, charucoCorners: cv2.typing.MatLike, charucoIds: cv2.typing.MatLike | None = ..., cornerColor: cv2.typing.Scalar = ...) -> cv2.typing.MatLike: ...
  214. @_typing.overload
  215. def drawDetectedCornersCharuco(image: cv2.UMat, charucoCorners: cv2.UMat, charucoIds: cv2.UMat | None = ..., cornerColor: cv2.typing.Scalar = ...) -> cv2.UMat: ...
  216. @_typing.overload
  217. def drawDetectedDiamonds(image: cv2.typing.MatLike, diamondCorners: _typing.Sequence[cv2.typing.MatLike], diamondIds: cv2.typing.MatLike | None = ..., borderColor: cv2.typing.Scalar = ...) -> cv2.typing.MatLike: ...
  218. @_typing.overload
  219. def drawDetectedDiamonds(image: cv2.UMat, diamondCorners: _typing.Sequence[cv2.UMat], diamondIds: cv2.UMat | None = ..., borderColor: cv2.typing.Scalar = ...) -> cv2.UMat: ...
  220. @_typing.overload
  221. def drawDetectedMarkers(image: cv2.typing.MatLike, corners: _typing.Sequence[cv2.typing.MatLike], ids: cv2.typing.MatLike | None = ..., borderColor: cv2.typing.Scalar = ...) -> cv2.typing.MatLike: ...
  222. @_typing.overload
  223. def drawDetectedMarkers(image: cv2.UMat, corners: _typing.Sequence[cv2.UMat], ids: cv2.UMat | None = ..., borderColor: cv2.typing.Scalar = ...) -> cv2.UMat: ...
  224. def extendDictionary(nMarkers: int, markerSize: int, baseDictionary: Dictionary = ..., randomSeed: int = ...) -> Dictionary: ...
  225. @_typing.overload
  226. def generateImageMarker(dictionary: Dictionary, id: int, sidePixels: int, img: cv2.typing.MatLike | None = ..., borderBits: int = ...) -> cv2.typing.MatLike: ...
  227. @_typing.overload
  228. def generateImageMarker(dictionary: Dictionary, id: int, sidePixels: int, img: cv2.UMat | None = ..., borderBits: int = ...) -> cv2.UMat: ...
  229. def getPredefinedDictionary(dict: int) -> Dictionary: ...