panel_verification.py 文件源码

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

项目:Cognitive-Face-Python 作者: Microsoft 项目源码 文件源码
def OnChooseImage(self, evt, bitmap, face_id):
        """Choose Image"""
        dlg = wx.FileDialog(self, wildcard=util.IMAGE_WILDCARD)
        if dlg.ShowModal() != wx.ID_OK:
            return
        path = dlg.GetPath()

        self.log.log('Request: Detecting {}'.format(path))
        res = util.CF.face.detect(path)
        faces = [model.Face(face, path) for face in res]
        self.log.log('Response: Success. Detected {} face(s) in {}'.format(
            len(res), path))

        if len(faces) > 1:
            text = (
                'Verification accepts two faces as input, please pick images'
                'with only one detectable face in it.'
            )
            title = 'Warning'
            style = wx.OK | wx.ICON_WARNING
            wx.MessageBox(text, title, style)
            return

        bitmap.set_path(path)
        util.draw_bitmap_rectangle(bitmap, faces)
        self.face_ids[face_id] = faces[0].id
        self.check_btn_verify()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号