这是一个模块,旨在为初学者抽象出使用opencv检测和识别人脸的复杂性。

visionmadeeas的Python项目详细描述


视觉变得简单

本项目旨在消除初级程序员对开放式CV处理的复杂性,进行人脸检测和识别实验。

这个项目最初是为了在我自己教的课程中使用而开发的,但我希望它也能为其他人找到用处。

项目主页

安装

pip install visionmadeeasy

要成功运行演示,您还必须…

演示代码

importvisionmadeeasydefi_see_a_face(location,img):print(f"I see a face!!! It is at {location['x']},{location['y']}")returnTrue# must return True to keep the loop alivedefi_recognise_a_face(location,person_name,confidence,img):print(f"Hello {person_name}! I am {confidence}% sure it is you :-)")returnTrue# must return True to keep the loop aliveif__name__=="__main__":vme=visionmadeeasy.VisionMadeEasy(0,"dataset")quit=Falsewhilenotquit:print("Demonstration time! Menu of options...")print("1. Detect faces")print("2. Record faces")print("3. Train for faces recorded")print("4. Recognise faces (must do training first)")print("5. Exit")choice=int(input("Enter your option (1 to 5):"))ifchoice==1:print("[face_vision] Task: Searching for faces.\nLook at the camera! (press ESC to quit)")# Demo of detecting facesvme.detect_face(i_see_a_face)elifchoice==2:print("About to save 50 images of different angles etc of a person, saving to folder ./dataset")id=int(input("Enter unique person number: "))n=input("Enter person name: ")print("Smile! :-)")# Demo of recording facesvme.record_face_dataset(images_to_record=50,interval=1,person_identifier=id,person_name=n)elifchoice==3:print("[face_vision] Task: Training... please wait...")# Demo of training facesvme.train_from_faces()elifchoice==4:print("[face_vision] Task: Searching for faces I recognise.\nLook at the camera! (press ESC to quit)")# Demo of recognising facesvme.recognise_face(i_recognise_a_face)elifchoice==5:quit=Trueprint("Goodbye!")

作者

许可证

麻省理工学院许可证(C)2019 Paul Baumgarten

欢迎加入QQ群-->: 979659372 Python中文网_新手群

推荐PyPI第三方库


热门话题
java如何在sqlite数据库中保存特定列的历史记录   java如何更改/更新timeseriechart名称(JFreeChart)   java如何将整数转换为可绘制的   汇编什么解释Java的字节码   java查找已编译的类版本号   我应该什么时候在ColdFusion应用程序中使用Java?   java当一个实体的两个字段为(unique=true)时,如何处理JPA异常?   java为什么在所有其他实例都正确的情况下返回错误的布尔值?   java Hibernate每次都准备语句   java停留在平均字长上   对Java和日语字符进行编码   java如何将导致异常的方法的错误消息传递给侦听器中的onTestFailure方法   java代码没有打印结果   java为什么私有内部接口的方法必须是公共的?   休眠发生错误。有关详细信息,请参阅错误日志。JAVAlang.NullPointerException