Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nagadomi/lbpcascade_animeface
A Face detector for anime/manga using OpenCV
https://github.com/nagadomi/lbpcascade_animeface
face-detector opencv
Last synced: 3 days ago
JSON representation
A Face detector for anime/manga using OpenCV
- Host: GitHub
- URL: https://github.com/nagadomi/lbpcascade_animeface
- Owner: nagadomi
- Created: 2014-11-07T05:46:49.000Z (about 10 years ago)
- Default Branch: master
- Last Pushed: 2018-11-23T05:53:31.000Z (about 6 years ago)
- Last Synced: 2025-01-12T07:03:13.322Z (10 days ago)
- Topics: face-detector, opencv
- Homepage:
- Size: 764 KB
- Stars: 1,937
- Watchers: 56
- Forks: 294
- Open Issues: 7
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# 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.pathdef 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, cv2.IMREAD_COLOR)
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])
```
Runpython detect.py imas.jpg
![result](https://user-images.githubusercontent.com/287255/43184241-ed3f1af8-9022-11e8-8800-468b002c73d9.png)
## Note
I am providing similar project at https://github.com/nagadomi/animeface-2009. animeface-2009 is my original work that was made before libcascade_animeface. The detection accuracy is higher than this project. However, installation of that is a bit complicated. Also I am providing a face cropping script using animeface-2009.