All Projects â†’ leblancfg â†’ Autocrop

leblancfg / Autocrop

Licence: other
😌 Automatically detects and crops faces from batches of pictures.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to Autocrop

Android Hpe
Android native application to perform head pose estimation using images coming from the front camera.
Stars: ✭ 46 (-85.62%)
Mutual labels:  opencv, face-detection, face
Human Detection And Tracking
Human-detection-and-Tracking
Stars: ✭ 753 (+135.31%)
Mutual labels:  opencv, face-detection, face
Facifier
An emotion and gender detector based on facial features, built with Python and OpenCV
Stars: ✭ 52 (-83.75%)
Mutual labels:  opencv, face-detection, face
Brfv4 mac examples
macOS C++ examples utilizing OpenCV for camera access and drawing the face tracking results.
Stars: ✭ 25 (-92.19%)
Mutual labels:  opencv, face-detection, face
Raspberrypi Facedetection Mtcnn Caffe With Motion
MTCNN with Motion Detection, on Raspberry Pi with Love
Stars: ✭ 204 (-36.25%)
Mutual labels:  jupyter-notebook, opencv, face
R-MTCNN
No description or website provided.
Stars: ✭ 11 (-96.56%)
Mutual labels:  face, face-detection
jeelizGlanceTracker
JavaScript/WebGL lib: detect if the user is looking at the screen or not from the webcam video feed. Lightweight and robust to all lighting conditions. Great for play/pause videos if the user is looking or not, or for person detection. Link to live demo.
Stars: ✭ 68 (-78.75%)
Mutual labels:  face, face-detection
facetool
Command line utility to manipulate faces in videos and images
Stars: ✭ 38 (-88.12%)
Mutual labels:  face, face-detection
DeepVTB
🌌 OpenVTuber-č™šæ‹Ÿã‚ĸイドãƒĢå…ąäēĢčŽĄåˆ’ An application of real-time face and gaze analyzation via deep nerual networks.
Stars: ✭ 32 (-90%)
Mutual labels:  face, face-detection
brfv4 android examples
Android Studio project (Java)
Stars: ✭ 43 (-86.56%)
Mutual labels:  face, face-detection
Insta flters with python
With this program you can add hat & glass on your face(it's support multiple faces)
Stars: ✭ 21 (-93.44%)
Mutual labels:  face, face-detection
Multi-Face-Comparison
This repo is meant for backend API for face comparision and computer vision. It is built on python flask framework
Stars: ✭ 20 (-93.75%)
Mutual labels:  face, face-detection
ARFaceFilter
Javascript/WebGL lightweight face tracking library designed for augmented reality webcam filters. Features : multiple faces detection, rotation, mouth opening. Various integration examples are provided (Three.js, Babylon.js, FaceSwap, Canvas2D, CSS3D...).
Stars: ✭ 72 (-77.5%)
Mutual labels:  face, face-detection
Cat-Face-Detector-with-OpenCV-and-JavaFX
📹 A Small OpenCV (Open Source Computer Vision) Example, who has the ability to detect multiple cat faces at the same time 🐱
Stars: ✭ 24 (-92.5%)
Mutual labels:  face, face-detection
face
[deprecated] đŸ‘Ŋ Face Recognition package for Laravel
Stars: ✭ 37 (-88.44%)
Mutual labels:  face, face-detection
visage
Add virtual makeup to picture of a face.
Stars: ✭ 97 (-69.69%)
Mutual labels:  face, face-detection
Look4Face
Demo of Face Recognition web service
Stars: ✭ 23 (-92.81%)
Mutual labels:  face, face-detection
Imagedetect
✂ī¸ Detect and crop faces, barcodes and texts in image with iOS 11 Vision api.
Stars: ✭ 286 (-10.62%)
Mutual labels:  face-detection, face
Powerai Counting Cars
Run a Jupyter Notebook to detect, track, and count cars in a video using Maximo Visual Insights (formerly PowerAI Vision) and OpenCV
Stars: ✭ 282 (-11.87%)
Mutual labels:  jupyter-notebook, opencv
Car Finding Lane Lines
Finding Lane Lines using Python and OpenCV
Stars: ✭ 299 (-6.56%)
Mutual labels:  jupyter-notebook, opencv

autocrop

Travis Status AppVeyor Build Status codecov Documentation PyPI version Downloads Language grade: Python

Perfect for profile picture processing for your website or batch work for ID cards, autocrop will output images centered around the biggest face detected.

Installation

Simple!

pip install autocrop

Use

Autocrop can be used from the command line or directly from Python API.

From Python

Import the Cropper class, set some parameters (optional), and start cropping.

The crop method accepts filepaths or np.ndarray, and returns Numpy arrays. These are easily handled with PIL or Matplotlib.

from PIL import Image
from autocrop import Cropper

cropper = Cropper()

# Get a Numpy array of the cropped image
cropped_array = cropper.crop('portrait.png')

# Save the cropped image with PIL
cropped_image = Image.fromarray(cropped_array)
cropped_image.save('cropped.png')

Further examples and use cases are found in the accompanying Jupyter Notebook.

From the command line

usage: [-h] [-o OUTPUT] [-i INPUT] [-w WIDTH] [-H HEIGHT] [-e EXTENSION] [-v]

Automatically crops faces from batches of pictures

optional arguments:
  -h, --help
  		Show this help message and exit
  -o, --output, -p, --path
		Folder where cropped images will be placed.
		Default: current working directory
  -r, --reject
		Folder where images without detected faces will be placed.
		Default: same as output directory
  -i, --input
		Folder where images to crop are located.
		Default: current working directory
  -w, --width
		Width of cropped files in px. Default=500
  -H, --height
		Height of cropped files in px. Default=500
  --facePercent
  		Zoom factor. Percentage of face height to image height.
  -e, --extension
  		Enter the image extension which to save at output.
  		Default: Your current image extension
  -v, --version
  		Show program's version number and exit

Examples

  • Crop every image in the pics folder, resize them to 400 px squares, and output them in the crop directory:
    • autocrop -i pics -o crop -w 400 -H 400.
    • Images where a face can't be detected will be left in crop.
  • Same as above, but output the images with undetected faces to the reject directory:
    • autocrop -i pics -o crop -r reject -w 400 -H 400.
  • Same as above but the image extension will be png:
    • autocrop -i pics -o crop -w 400 -H 400 -e png

If no output folder is added, asks for confirmation and destructively crops images in-place.

Supported file types

The following file types are supported:

  • EPS files (.eps)
  • GIF files (.gif) (only the first frame of an animated GIF is used)
  • JPEG 2000 files (.j2k, .j2p, .jp2, .jpx)
  • JPEG files (.jpeg, .jpg, .jpe)
  • LabEye IM files (.im)
  • macOS ICNS files (.icns)
  • Microsoft Paint bitmap files (.msp)
  • PCX files (.pcx)
  • Portable Network Graphics (.png)
  • Portable Pixmap files (.pbm, .pgm, .ppm)
  • SGI files (.sgi)
  • SPIDER files (.spi)
  • TGA files (.tga)
  • TIFF files (.tif, .tiff)
  • WebP (.webp)
  • Windows bitmap files (.bmp, .dib)
  • Windows ICO files (.ico)
  • X bitmap files (.xbm)

Gotchas

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.

Installing directly

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 .

conda

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.

Requirements

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 3.6+
  • OS:
    • Linux
    • macOS
    • Windows

More Info

Check out:

Adapted from:

Contributing

Although autocrop is essentially a CLI wrapper around a single OpenCV function, it is actively developed. It has active users throughout the world.

If you would like to contribute, please consult the contribution docs.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].