Perfect for batch work for ID cards or profile picture processing for your website, autocrop will output images centered around the biggest face detected.
usage: autocrop [-h] [-p PATH] [-w WIDTH] [-H HEIGHT] [-v]
optional arguments:
-h, --help show this help message and exit
-p PATH, --path PATH folder where images to crop are located. Default:
photos/
-w WIDTH, --width WIDTH
width of cropped files in px. Default: 500
-H HEIGHT, --height HEIGHT
height of cropped files in px. Default: 500
-v, --version show program's version number and exit
Simple! In your command line, type:
pip install autocrop
Autocrop uses OpenCV to perform face detection, which is installed through binary wheels. If you already have OpenCV 3+ installed, you may wish to uninstall the additional OpenCV installation: pip uninstall opencv-python
.
Development of a conda-forge
package for the Anaconda Python distribution is also currently slated for development. Please leave feedback on issue #7 if you are insterested in helping out.
In some cases, you may wish the package directly, instead of through PyPI:
cd ~
git clone https://github.com/leblancfg/autocrop
cd autocrop
pip install .
Best practice for your projects is of course to use virtual environments. At the very least, you will need to have pip installed.
Autocrop is currently being tested on:
- Python:
- 2.7
- 3.4
- 3.5
- 3.6
- OS:
- Linux
- macOS
- Windows
Check out:
- http://docs.opencv.org/master/d7/d8b/tutorial_py_face_detection.html#gsc.tab=0
- http://docs.opencv.org/master/d5/daf/tutorial_py_histogram_equalization.html#gsc.tab=0
Adapted from: