__init__.pyi 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220
  1. __all__: list[str] = []
  2. import cv2
  3. import cv2.typing
  4. import os
  5. import typing as _typing
  6. # Classes
  7. class FaceRecognizer(cv2.Algorithm):
  8. # Functions
  9. @_typing.overload
  10. def train(self, src: _typing.Sequence[cv2.typing.MatLike], labels: cv2.typing.MatLike) -> None: ...
  11. @_typing.overload
  12. def train(self, src: _typing.Sequence[cv2.UMat], labels: cv2.UMat) -> None: ...
  13. @_typing.overload
  14. def update(self, src: _typing.Sequence[cv2.typing.MatLike], labels: cv2.typing.MatLike) -> None: ...
  15. @_typing.overload
  16. def update(self, src: _typing.Sequence[cv2.UMat], labels: cv2.UMat) -> None: ...
  17. @_typing.overload
  18. def predict_label(self, src: cv2.typing.MatLike) -> int: ...
  19. @_typing.overload
  20. def predict_label(self, src: cv2.UMat) -> int: ...
  21. @_typing.overload
  22. def predict(self, src: cv2.typing.MatLike) -> tuple[int, float]: ...
  23. @_typing.overload
  24. def predict(self, src: cv2.UMat) -> tuple[int, float]: ...
  25. @_typing.overload
  26. def predict_collect(self, src: cv2.typing.MatLike, collector: PredictCollector) -> None: ...
  27. @_typing.overload
  28. def predict_collect(self, src: cv2.UMat, collector: PredictCollector) -> None: ...
  29. def write(self, filename: str | os.PathLike[str]) -> None: ...
  30. def read(self, filename: str | os.PathLike[str]) -> None: ...
  31. def setLabelInfo(self, label: int, strInfo: str) -> None: ...
  32. def getLabelInfo(self, label: int) -> str: ...
  33. def getLabelsByString(self, str: str) -> _typing.Sequence[int]: ...
  34. class BIF(cv2.Algorithm):
  35. # Functions
  36. def getNumBands(self) -> int: ...
  37. def getNumRotations(self) -> int: ...
  38. @_typing.overload
  39. def compute(self, image: cv2.typing.MatLike, features: cv2.typing.MatLike | None = ...) -> cv2.typing.MatLike: ...
  40. @_typing.overload
  41. def compute(self, image: cv2.UMat, features: cv2.UMat | None = ...) -> cv2.UMat: ...
  42. @classmethod
  43. def create(cls, num_bands: int = ..., num_rotations: int = ...) -> BIF: ...
  44. class FacemarkKazemi(Facemark):
  45. ...
  46. class Facemark(cv2.Algorithm):
  47. # Functions
  48. def loadModel(self, model: str) -> None: ...
  49. @_typing.overload
  50. def fit(self, image: cv2.typing.MatLike, faces: cv2.typing.MatLike, landmarks: _typing.Sequence[cv2.typing.MatLike] | None = ...) -> tuple[bool, _typing.Sequence[cv2.typing.MatLike]]: ...
  51. @_typing.overload
  52. def fit(self, image: cv2.UMat, faces: cv2.UMat, landmarks: _typing.Sequence[cv2.UMat] | None = ...) -> tuple[bool, _typing.Sequence[cv2.UMat]]: ...
  53. class FacemarkAAM(FacemarkTrain):
  54. ...
  55. class FacemarkTrain(Facemark):
  56. ...
  57. class FacemarkLBF(FacemarkTrain):
  58. ...
  59. class BasicFaceRecognizer(FaceRecognizer):
  60. # Functions
  61. def getNumComponents(self) -> int: ...
  62. def setNumComponents(self, val: int) -> None: ...
  63. def getThreshold(self) -> float: ...
  64. def setThreshold(self, val: float) -> None: ...
  65. def getProjections(self) -> _typing.Sequence[cv2.typing.MatLike]: ...
  66. def getLabels(self) -> cv2.typing.MatLike: ...
  67. def getEigenValues(self) -> cv2.typing.MatLike: ...
  68. def getEigenVectors(self) -> cv2.typing.MatLike: ...
  69. def getMean(self) -> cv2.typing.MatLike: ...
  70. class EigenFaceRecognizer(BasicFaceRecognizer):
  71. # Functions
  72. @classmethod
  73. def create(cls, num_components: int = ..., threshold: float = ...) -> EigenFaceRecognizer: ...
  74. class FisherFaceRecognizer(BasicFaceRecognizer):
  75. # Functions
  76. @classmethod
  77. def create(cls, num_components: int = ..., threshold: float = ...) -> FisherFaceRecognizer: ...
  78. class LBPHFaceRecognizer(FaceRecognizer):
  79. # Functions
  80. def getGridX(self) -> int: ...
  81. def setGridX(self, val: int) -> None: ...
  82. def getGridY(self) -> int: ...
  83. def setGridY(self, val: int) -> None: ...
  84. def getRadius(self) -> int: ...
  85. def setRadius(self, val: int) -> None: ...
  86. def getNeighbors(self) -> int: ...
  87. def setNeighbors(self, val: int) -> None: ...
  88. def getThreshold(self) -> float: ...
  89. def setThreshold(self, val: float) -> None: ...
  90. def getHistograms(self) -> _typing.Sequence[cv2.typing.MatLike]: ...
  91. def getLabels(self) -> cv2.typing.MatLike: ...
  92. @classmethod
  93. def create(cls, radius: int = ..., neighbors: int = ..., grid_x: int = ..., grid_y: int = ..., threshold: float = ...) -> LBPHFaceRecognizer: ...
  94. class MACE(cv2.Algorithm):
  95. # Functions
  96. def salt(self, passphrase: str) -> None: ...
  97. @_typing.overload
  98. def train(self, images: _typing.Sequence[cv2.typing.MatLike]) -> None: ...
  99. @_typing.overload
  100. def train(self, images: _typing.Sequence[cv2.UMat]) -> None: ...
  101. @_typing.overload
  102. def same(self, query: cv2.typing.MatLike) -> bool: ...
  103. @_typing.overload
  104. def same(self, query: cv2.UMat) -> bool: ...
  105. @classmethod
  106. def load(cls, filename: str | os.PathLike[str], objname: str = ...) -> MACE: ...
  107. @classmethod
  108. def create(cls, IMGSIZE: int = ...) -> MACE: ...
  109. class PredictCollector:
  110. ...
  111. class StandardCollector(PredictCollector):
  112. # Functions
  113. def getMinLabel(self) -> int: ...
  114. def getMinDist(self) -> float: ...
  115. def getResults(self, sorted: bool = ...) -> _typing.Sequence[tuple[int, float]]: ...
  116. @classmethod
  117. def create(cls, threshold: float = ...) -> StandardCollector: ...
  118. # Functions
  119. def createFacemarkAAM() -> Facemark: ...
  120. def createFacemarkKazemi() -> Facemark: ...
  121. def createFacemarkLBF() -> Facemark: ...
  122. @_typing.overload
  123. def drawFacemarks(image: cv2.typing.MatLike, points: cv2.typing.MatLike, color: cv2.typing.Scalar = ...) -> cv2.typing.MatLike: ...
  124. @_typing.overload
  125. def drawFacemarks(image: cv2.UMat, points: cv2.UMat, color: cv2.typing.Scalar = ...) -> cv2.UMat: ...
  126. @_typing.overload
  127. def getFacesHAAR(image: cv2.typing.MatLike, face_cascade_name: str, faces: cv2.typing.MatLike | None = ...) -> tuple[bool, cv2.typing.MatLike]: ...
  128. @_typing.overload
  129. def getFacesHAAR(image: cv2.UMat, face_cascade_name: str, faces: cv2.UMat | None = ...) -> tuple[bool, cv2.UMat]: ...
  130. def loadDatasetList(imageList: str, annotationList: str, images: _typing.Sequence[str], annotations: _typing.Sequence[str]) -> bool: ...
  131. @_typing.overload
  132. def loadFacePoints(filename: str | os.PathLike[str], points: cv2.typing.MatLike | None = ..., offset: float = ...) -> tuple[bool, cv2.typing.MatLike]: ...
  133. @_typing.overload
  134. def loadFacePoints(filename: str | os.PathLike[str], points: cv2.UMat | None = ..., offset: float = ...) -> tuple[bool, cv2.UMat]: ...
  135. @_typing.overload
  136. def loadTrainingData(filename: str | os.PathLike[str], images: _typing.Sequence[str], facePoints: cv2.typing.MatLike | None = ..., delim: str = ..., offset: float = ...) -> tuple[bool, cv2.typing.MatLike]: ...
  137. @_typing.overload
  138. def loadTrainingData(filename: str | os.PathLike[str], images: _typing.Sequence[str], facePoints: cv2.UMat | None = ..., delim: str = ..., offset: float = ...) -> tuple[bool, cv2.UMat]: ...
  139. @_typing.overload
  140. def loadTrainingData(imageList: str, groundTruth: str, images: _typing.Sequence[str], facePoints: cv2.typing.MatLike | None = ..., offset: float = ...) -> tuple[bool, cv2.typing.MatLike]: ...
  141. @_typing.overload
  142. def loadTrainingData(imageList: str, groundTruth: str, images: _typing.Sequence[str], facePoints: cv2.UMat | None = ..., offset: float = ...) -> tuple[bool, cv2.UMat]: ...
  143. @_typing.overload
  144. def loadTrainingData(filename: _typing.Sequence[str], trainlandmarks: _typing.Sequence[_typing.Sequence[cv2.typing.Point2f]], trainimages: _typing.Sequence[str]) -> bool: ...