这是一个模块,旨在为初学者抽象出使用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中未按预期工作   JavaSpringWebClient:自动计算主体的HMAC签名并将其作为头传递   foreach是否有一个Java等效的foreach循环和一个引用变量?   java如何在Eclipse中导入jar   使用特定第三方或java时lombok触发错误。*方法或构造函数   安卓 java将对象数组转换为int数组   java使一定百分比的JUnit测试通过   java Android:将Seekbar的一个值与另一个值进行比较   java将int数组(图像数据)写入文件的最佳方式是什么   java取代了系统。yml的构造函数内的getProperty   sqlite Java将公钥和私钥转换为字符串,然后再转换回字符串   安卓获取白色像素并将其保存到java opencv中的数组中   java为什么是ServerSocket。setSocketFactory静态?   Java数组似乎在不直接修改的情况下更改值