ocv_detection.py 文件源码

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

项目:GLMF203 作者: GLMF 项目源码 文件源码
def archive_with_items(self):
        """ Ecrit dans le dossier d'archive la frame complète avec des carrés dessinés autour
            des visages détectés
        """
        logging.info("Archive l'image avec les items trouvés...")
        # Dessine un carré autour de chaque item
        for f in self.items: 
            x, y, w, h = f #[ v for v in f ] 
            cv2.rectangle(self.frame, (x,y), (x+w,y+h), (0,255,0), 3) 

        # Ajoute la date et l'heure à l'image
        cv2.putText(self.frame, datetime.datetime.now().strftime("%c"), (5, 25), 
                    cv2.FONT_HERSHEY_SIMPLEX, 0.8, (0,0,0), 3) 

        # On affiche l'image qui va être archivée dans une fenêtre
        if self.debug:
            cv2.imshow("preview", self.frame) 
            cv2.waitKey() 

        # Ecriture du fichier
        archive_full_name = "{0}_full.jpg".format(self.images_prefix)
        logging.info("Archive file is : '{0}'".format(archive_full_name))
        cv2.imwrite(os.path.join(self.archive_folder,  archive_full_name), self.frame)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号