__init__.pyi 13 KB

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