qcasey / auto-image-rotator

Automatically rotates images to their proper orientation based on detected faces.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Auto Image Rotator

Overview

This app uses the OpenCV and Dlib computer vision libraries to auto rotate images based on detected human faces.

This is useful for auto rotating images in bulk that do not contain EXIF orientation meta data (e.g., scanned photos).

Currently, this is only effective for images that contain one or more face. In the future, advanced CNN techniques could be implemented to auto correct the rotation for any photo.

title

Setup

Docker

  1. Install Docker so we can build and run the app

  2. Build the app's Docker image (this takes a few minutes to complete while it builds Dlib's native C extension for Python):

docker-compose build app

Usage

After the one-time setup, rotating a directory of images is as simple as running this command:

IMAGES_PATH=/path/to/your/images/folder docker-compose run app

By default, rotated images are saved as new files with a *-rotated filename pattern in your IMAGES_PATH directory. If you're comfortable overwriting your original files with rotated versions you may prefix the command with the OVERWRITE_FILES param like so:

IMAGES_PATH=/path/to/your/images/folder OVERWRITE_FILES=1 docker-compose run app

About

Automatically rotates images to their proper orientation based on detected faces.


Languages

Language:Python 86.5%Language:Dockerfile 13.5%