def OPENCV_getAllFaceBoundingBoxes(self, rgbImg):
"""
Find all face bounding boxes in an image.
:param rgbImg: RGB image to process. Shape: (height, width, 3)
:type rgbImg: numpy.ndarray
:return: All face bounding boxes in an image.
:rtype: opencv.rectangles
"""
assert rgbImg is not None
lit=[]
try:
faces = self.OPENCV_Detector.detectMultiScale(rgbImg)
for (x, y, w, h) in faces:
lit.append(dlib.rectangle(int(x),int(y),int(x+w),int(y+h)))
return lit
except Exception as e:
print("Warning: {}".format(e))
# In rare cases, exceptions are thrown.
return []
评论列表
文章目录