Skip to content
This repository has been archived by the owner on Nov 21, 2020. It is now read-only.

A simple command line tool to detect faces in photographs using Apple’s Core Image Library

Notifications You must be signed in to change notification settings

kachkaev/CICommandLineFaceDetector

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 

Repository files navigation

CICommandLineFaceDetector

A simple command line tool to detect faces in photographs using Apple’s Core Image Library.

The app runs in the terminal and returns the coordinates of the faces found by Core Image in files defined by their paths. The processing of one image takes milliseconds. The tool can be easily integrated with apps written in PHP, Java, Ruby, etc.

After the launch of the app the user is asked to enter the absolute path of a photograph followed by \n. The tool returns the coordinates of all faces that have been found: [[face1_left, face1_top, face1_width, face1_height], [face2_left, ...], ...]. An error message is shown instead in case of a problem (also in stdout). The user is asked to enter another image path after that. To exit the tool an empty string or EOF should be entered.

The app accepts --low-accuracy as a parameter to use a faster version of the Core Image face detection algorithm.

The tool has been developed and tested on Mac OS 10.8 Mountain Lion, but will probably work on the earlier versions of it. You can clone the repository and build the app in xCode yourself or simply try to run the compiled executable file.

Usage Example

$ ./CICommandLineFaceDetector 
Enter image path> /path/to/image.jpg
[[206,71,56,56],[130,101,40,40]]
Enter image path> /path/to/image2.jpg
[]
Enter image path> /wrong/path/to/image.jpg
Error: file does not exist
Enter image path> /path/to/broken/image.jpg
Error: wrong image
Enter image path> /path/to/image3.jpg
[[235,241,44,44]]
Enter image path> 
$ 
$./CICommandLineFaceDetector --low-accuracy # Faster but less accurate
Enter image path> /path/to/image.jpg
[[206,71,56,56],[130,101,40,40]] # The result is a bit different 
Enter image path> /path/to/image3.jpg
[] # Some faces can not be found when --low-accuracy is on
Enter image path> 
$ 

Limitations

The tool does not look into the EXIF data and therefore does not consider the orientation of the images. Thus, the photographs having [0,0] not in the top-left corner will not be handled correctly. It is important to make sure that the faces are in the upright position because CoreImage mostly detects only them.

About

A simple command line tool to detect faces in photographs using Apple’s Core Image Library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published