lbpcascade_animeface-master
所属分类:图形图像处理
开发工具:Python
文件大小:778KB
下载次数:3
上传日期:2018-03-26 13:27:30
上 传 者:
程序员飞宇
说明: 利用opencv资源库里自带的lbpcascade_animeface.xml,对普通人脸进行识别,如果有数据库的话,也可以自己训练学习,提取人脸特征,进行学习
(We use the lbpcascade_animeface.xml in opencv repository to recognize normal faces. If there are databases, we can also train ourselves to learn, extract facial features and learn.)
文件列表:
examples (0, 2015-01-19)
examples\detect.py (962, 2015-01-19)
figure (0, 2015-01-19)
figure\imas.png (736423, 2015-01-19)
lbpcascade_animeface.xml (246945, 2015-01-19)
# lbpcascade_animeface
The face detector for anime/manga using OpenCV.
Original release since 2011 at [OpenCVによるアニメ顔検出ならlbpcascade_animeface.xml](http://ultraist.hatenablog.com/entry/20110718/1310965532) (in Japanese)
## Usage
Download and place the cascade file into your project directory.
wget https://raw.githubusercontent.com/nagadomi/lbpcascade_animeface/master/lbpcascade_animeface.xml
### Python Example
```python
import cv2
import sys
import os.path
def detect(filename, cascade_file = "../lbpcascade_animeface.xml"):
if not os.path.isfile(cascade_file):
raise RuntimeError("%s: not found" % cascade_file)
cascade = cv2.CascadeClassifier(cascade_file)
image = cv2.imread(filename)
gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY)
gray = cv2.equalizeHist(gray)
faces = cascade.detectMultiScale(gray,
# detector options
scaleFactor = 1.1,
minNeighbors = 5,
minSize = (24, 24))
for (x, y, w, h) in faces:
cv2.rectangle(image, (x, y), (x + w, y + h), (0, 0, 255), 2)
cv2.imshow("AnimeFaceDetect", image)
cv2.waitKey(0)
cv2.imwrite("out.png", image)
if len(sys.argv) != 2:
sys.stderr.write("usage: detect.py \n")
sys.exit(-1)
detect(sys.argv[1])
```
Run
python detect.py imas.jpg
![result](https://raw.githubusercontent.com/nagadomi/lbpcascade_animeface/master/figure/imas.png)
近期下载者:
相关文件:
收藏者: