Skip to content
master
Switch branches/tags
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 

facethumbnail

Thumbnail generator that preserves the face in the final image

Consider the image below

Sample Image

Now if we simply generate a square thumbnail from this, it will generate something like below

Sample Thumbnail

The head is cut off. facethumbnail tries to detect faces in pictures and attempts to choose a region of image so that the thumbnail contains the face properly, as follows

Sample Thumbnail

Facethumbnail also supports images with multiple faces and uses the largest face as the center of the thumbnail.

Build/Test

Clone this repo and in the folder run the following commands

go get
go build .
go test . -v

Sample

A sample use is

pwd, _ := os.Getwd()                                   // get the current directory
cascadeFile := path.Join(pwd, "test", "facefinder")    // get path to the facefinder binary
fd := GetFaceDetector(cascadeFile, -1, -1)             // create facedetector instance
result, err := ResizeImage(fd, srcPath, dstPath, 200)  // resize image!!

For more sample usage see the test file

How Does this work

This project uses github.com/esimov/pigo/core to detect the face, then generate thumbnail with the detected face centered.

Known issues

  1. Works for only jpeg

About

Thumbnail generator that preserves the face in the final image

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages