Smart crops images uisng OpenCV, forked from epixelic/python-smart-crop
, and improve more
Uses the algorithms described in https://github.com/thumbor/thumbor/wiki/Detection-algorithms but actually combining both methods. We try to detect faces on the image, then, in any case we detect features. We then combine both results with different weights, so face detection is, in this case 3,33 times stronger than feature detection.
Requires python-opencv, install the dependency with pip install python-opencv
Install the command using PIP: pip install git+https://github.com/fizzday/imageCropSmart
Tested on Debian 8 and Ubuntu WSL and mac 10.13.1
Usage: smartcrop -W 640 -H 360 -i input.jpg -o output.jpg
See smartcrop --help
import smartcrop
img_input = "input.jpg"
img_output = "output.jpg"
img_width = 400
img_height = 300
smartcrop.smart_crop(img_input, img_width, img_height, img_output, None)
Any Case : you can run the code in ./smartcrop/_init_.py