臉部偵測 for Windows use Python
使用Python練習OpenCV,順便做個紀錄
- Demo Video - Windows
- 臉部偵測(圖片)
請先確定電腦上已經安裝 OpenCV 和 numpy
可參考如何在Windows安裝OpenCV Python設定
python face_detect.py [圖片檔名] [haarcascade.xml]
python face_detect.py test1.jpg haarcascade_frontalface_alt.xml
目錄底下會多出一張名稱為 face_detection.jpg 的圖片
程式基本上只做了小小的修改,
我發現 haarcascade_frontalface_alt.xml 比原作者的 haarcascade_frontalface_default.xml 有更好的辨識率,
更多的 haarcascade 可到 opencv 路徑裡 opencv\sources\data\haarcascades 取得,
路徑底下還有 haarcascade_eye.xml 偵測眼睛之類的,大家可以自行摸索,
最後,請注意,這是 臉部偵測 ,並不是 臉部辨識
更多的資訊可參考原作者
Run the code like this:
python face_detect.py abba.png haarcascade_frontalface_default.xml
If you want to understand how the code works, the details are here:
https://realpython.com/blog/python/face-recognition-with-python/
記錄, OpenCV 學習路徑, (3) 人臉辨識
這篇文章介紹的蠻詳細的,包括可以自己訓練一套專屬用途的 Cascade classifier
- Windows 8.1
- Python 2.7.3
- OpenCV 2.4.12
- numpy 1.11.0
MIT license