Metadata-Version: 2.1
Name: animeface
Version: 2.0.0
Summary: A library to detect anime faces in images.
Home-page: https://github.com/nya3jp/python-animeface
Author: takahashi.shuhei@gmail.com
Author-email: takahashi.shuhei@gmail.com
License: UNKNOWN
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: pillow

# python-animeface

[![PyPI](https://img.shields.io/pypi/v/animeface.svg)](https://pypi.python.org/pypi/animeface)
[![Build](https://github.com/nya3jp/python-animeface/actions/workflows/build.yaml/badge.svg?branch=main)](https://github.com/nya3jp/python-animeface/actions/workflows/build.yaml)
[![License](https://img.shields.io/github/license/nya3jp/python-animeface.svg)](https://github.com/nya3jp/python-animeface/blob/main/LICENSE)

python-animeface is a Python wrapper of AnimeFace, a library to detect
anime character faces in images.

See also [the official website of AnimeFace] (in Japanese language).

[the official website of AnimeFace]: http://anime.udp.jp/imager-animeface.html


## Installation

You can install this module with PIP.

```
pip install animeface
```

In case a Python binary package (wheel) is not available for your environment,
you need to install libnvxs (the original AnimeFace library) before installing
python-animeface. The source code of libnvxs is included in this repository.

```
cd third_party/nvxs-1.0.2
./configure
make
sudo make install
```


## Usage

```
>>> import animeface
>>> import PIL.Image
>>> im = PIL.Image.open('/path/to/image.jpg')
>>> faces = animeface.detect(im)
>>> faces
[<animeface.Face likelihood=1.000000 face=<pos=(295, 90; 182, 182)> skin=<color=(253, 226, 212)> hair=<color=(199, 194, 196)> left_eye=<pos=(408, 134; 34, 42), color=(92, 42, 49)> right_eye=<pos=(316, 137; 55, 48), color=(79, 33, 39)> mouth=<pos=(372, 202; 32, 23)> nose=<pos=(397, 186)> chin=<pos=(377, 242)>>]
>>> fp = faces[0].face.pos
>>> print(fp.x, fp.y, fp.width, fp.height)
295 90 182 182
```

See [`animeface/__init__.py`] for the API definitions.

[`animeface/__init__.py`]: https://github.com/nya3jp/python-animeface/blob/main/animeface/__init__.py


## License

python-animeface is licenced under [Apache License](LICENSE).

The original AnimeFace library is licenced under NYSL.


