aws-solutions / serverless-image-handler

A solution to dynamically handle images on the fly, utilizing SharpJS
Apache License 2.0
1.32k stars 532 forks source link

Feature Request: Face detection cropping #4

Closed mjamesderocher closed 6 years ago

mjamesderocher commented 7 years ago

This is by far the easiest way to get Thumbor up and running, but it would be nice to see a way to set it up with automatic face cropping.

stevemorad commented 7 years ago

Thanks for the feature request. Would you elaborate on your use case?

mjamesderocher commented 7 years ago

I am working on a blog. I want to be able to add photos to posts, and no matter how it is cropped based on the layout, you would always be able to see the focus of the photo. On Tuesday, September 26, 2017 at 5:02 AM stevemorad notifications@github.com wrote:

Thanks for the feature request. Would you elaborate on your use case?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

stevemorad commented 7 years ago

Thanks. That helps. Some follow up questions:

  1. Are the photos of only one person? If not, how would you expect the feature to work with multiple faces, especially if there was a cropping conflict?
  2. How would you like the cropping logic to work? Center the face(s), somehow try to incorporate the rule of thirds?
mjamesderocher commented 7 years ago

I guess I didn't think it through that far. I was just thinking about the ability to use Thumbor's built in smart image cropping with the face detector. See http://thumbor.readthedocs.io/en/latest/enabling_detectors.html#using-it

On Tuesday, September 26, 2017 at 3:53 PM stevemorad notifications@github.com wrote:

Thanks. That helps. Some follow up questions:

Are the photos of only one person? If not, how would you expect the feature to work with multiple faces, especially if there was a cropping conflict? How would you like the cropping logic to work? Center the face(s), somehow try to incorporate the rule of thirds? — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub, or mute the thread.

gmarchand commented 6 years ago

Hello @stevemorad

Have you seen this Thumbor plugin https://github.com/yu-liang-kono/thumbor_rekognition made by @yu-liang-kono.

He uses Amazon Rekognition instead of OpenCV (default detector in Thumbor).

It will be a significant enhancement

myyellowshoe commented 6 years ago

I second this. I specifically chose thumbor for its smart cropping. Interesting that the default smart feature wasn't enabled out of the box.

@gmarchand Thanks for the heads up on that project, I'll check it out.

myyellowshoe commented 6 years ago

Working on getting this up and rolling myself with the default face/feature detection.

Shouldn't it just be as simple as un-commenting the following lines?

DETECTORS = [ 'thumbor.detectors.face_detector', 'thumbor.detectors.profile_detector',

'thumbor.detectors.glasses_detector',

'thumbor.detectors.feature_detector',

] I published up a new version to lambda, but still getting an "internal server error" when using /smart in my url.

Thoughts?

stevemorad commented 6 years ago

We are testing a new update to support this request. Would anyone mind testing the following template and provide feedback if this is what you are looking for? https://s3.amazonaws.com/solutions-test-reference/serverless-image-handler/latest/serverless-image-handler.template

stevemorad commented 6 years ago

This has been enabled in v2.2 and the demo UI has also been updated with some face examples to allow users to test out and determine how to use this feature.

Closing this issue based on v2.2 updates. Please reopen if this issue has not been fixed.