Skip to content

Commit

Permalink
add README
Browse files Browse the repository at this point in the history
  • Loading branch information
nagadomi committed Nov 7, 2014
1 parent b99c2d5 commit ec097ff
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*~
examples/out.png
44 changes: 44 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# lbpcascade_animeface

The face detector for anime/manga using OpenCV.

## Usage

Download and place the cascade file to your project directory.

wget https://raw.githubusercontent.com/nagadomi/lbpcascade_animeface/master/lbpcascade_animeface.xml

### Python Example

```python
import cv2
import cv
import sys

def detect(filename):
cascade = cv2.CascadeClassifier("../lbpcascade_animeface.xml")
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),
flags = cv.CV_HAAR_SCALE_IMAGE)
for (x, y, w, h) in faces:
cv2.rectangle(image, (x, y), (x + w, y + h), (0, 0, 255), 2)

cv2.imshow("AnimeFaceDtect", image)
cv2.waitKey(0)
cv2.imwrite("out.png", image)

if __name__ == "__main__":
detect(sys.argv[1])
```
Run

python detect.py imas.jpg

![result](https://raw.githubusercontent.com/nagadomi/lbpcascade_animeface/master/figure/imas.png)

0 comments on commit ec097ff

Please sign in to comment.