Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/fizzday/imagecropsmart
image smart crop with opencv in python (图片智能裁剪, 获取更优化的裁剪结果, 包括人像, 主要建筑物等, 通过计算, 智能裁剪出相对理想的图片)
https://github.com/fizzday/imagecropsmart
image image-crop opencv python smart smart-crop
Last synced: 7 days ago
JSON representation
image smart crop with opencv in python (图片智能裁剪, 获取更优化的裁剪结果, 包括人像, 主要建筑物等, 通过计算, 智能裁剪出相对理想的图片)
- Host: GitHub
- URL: https://github.com/fizzday/imagecropsmart
- Owner: fizzday
- License: mit
- Created: 2018-04-24T05:30:02.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-04-24T05:47:01.000Z (over 6 years ago)
- Last Synced: 2024-11-01T01:42:06.736Z (14 days ago)
- Topics: image, image-crop, opencv, python, smart, smart-crop
- Language: Python
- Size: 298 KB
- Stars: 47
- Watchers: 3
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# image smart crop(图片智能裁剪)
## description
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.
## Installing
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
- #### *command line*
Usage: `smartcrop -W 640 -H 360 -i input.jpg -o output.jpg`See `smartcrop --help`
- #### *python source code*
```python
import smartcropimg_input = "input.jpg"
img_output = "output.jpg"
img_width = 400
img_height = 300smartcrop.smart_crop(img_input, img_width, img_height, img_output, None)
```Any Case : you can run the code in `./smartcrop/_init_.py`
## example1
- input.jpg
![input.jpg](https://raw.githubusercontent.com/fizzday/imageCropSmart/master/smartcrop/input.jpg)
- crop
```
smartcrop -W 400 -H 300 -i input.jpg -o output.jpg
```
![output.jpg](https://raw.githubusercontent.com/fizzday/imageCropSmart/master/smartcrop/output.jpg)
## example2
- input2.jpg
![input2.jpg](https://raw.githubusercontent.com/fizzday/imageCropSmart/master/smartcrop/input2.jpg)
```
smartcrop -W 400 -H 300 -i input2.jpg -o output2.jpg
```
![output2.jpg](https://raw.githubusercontent.com/fizzday/imageCropSmart/master/smartcrop/output2.jpg)