Python wrapper of Stasm for finding features in faces.
This has been tested with Python 3.6.5, 3.7 and OpenCV 3.4.1.
To use:
$ pip install stasm
Stasm is a C++ software library for finding features in faces. PyStasm is a library wrapper with simplified Pythonic syntax using the Python C API built on top of OpenCV and NumPy. For example, to get a list of facial landmarks from an image:
import cv2, stasm
img = cv2.imread(imgpath, cv2.IMREAD_GRAYSCALE)
landmarks = stasm.search_single(img)
A full Python version of the minimal Stasm C++ example is located in the documentation.
- numpy >= 1.10
- OpenCV >= 3.0
The recommended way to install stasm is through PyPI:
$ pip install stasm
To build from source, make sure you have the OpenCV headers and libraries in your include/library paths and then run:
$ python setup.py install
ImportError: libopencv_core.so.3.4: cannot open shared object file: No such file or directory
.
Run: export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
For information specific to this wrapper, take a look at the PyStasm API reference. For further information about Stasm consult the user manual. To build the PyStasm docs:
$ pip install Sphinx
$ python setup.py build_ext --inplace
$ cd doc
$ make html
Both this software and Stephen Milborrow's original Stasm library are subject to the terms of the BSD-style Stasm License Agreement, available in LICENSE.txt
.