align_dlib.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:EyesInTheSky 作者: SherineSameh 项目源码 文件源码
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 []
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号