Face gravity transformation, false positives?

Options
jammin
jammin Member Posts: 4
edited June 2023 in Developer APIs

Hi There,

Brand new to cloudinary and just having a play with the face recognition.

In my project I build a URL (using the Vue sdk) to transform an image by cropping to a face if it's found, but to simply fit the image to dimensions if no face is found.

So far the image recognition seems great, but for images with no face, I'm often (1:10) finding that it crops to a non-face.

Any ideas on what I might do differently?

image/upload/if_fc_gt_0/c_thumb,g_face,h_200,w_200/if_else/c_fill,h_200,w_200/if_end/r_10/v1/

image/upload/if_fc_gt_0/c_thumb,h_200,w_200/if_else/c_fill,h_200,w_200/if_end/r_10/v1/


Apologies if this has already been discussed a lot.

Answers

  • Tamara
    Tamara Member, Cloudinary Staff Posts: 102
    Options

    Hi there,

    This seems expected; c_fill,h_200,w_200/ - In the "else" block applies a fill crop (c_fill) to ensure the image fills a 200x200-pixel area. It may result in cropping the image to fit the specified dimensions if the image is larger. If you don't want the image to be cropped, just get rid of the "else" part.

    Regards,

    Tamara

  • jammin
    jammin Member Posts: 4
    Options

    Hi Tamara,

    Thanks for getting back to me!

    If there is no face, I do want the image to crop but still to show the maximum it can within the dimensions specified.

    See the second example above that still has the 'else' option but with only the 'g_face' option removed from the url and how it has only cropped the image slightly. No scaling has occurred in the second option just copping which is what I want.

    Like I say, 9:10 times it works fine, it's just the odd image like the one above where it doesn't seem to work.

    Thanks again for your help!

    Ben

  • victor_cloudinary
    victor_cloudinary Member, Cloudinary Staff Posts: 9
    Options

    Hi Ben jammin :),

    To more thoroughly investigate, could you please submit a support ticket at https://support.cloudinary.com and include full URLs and specifically mention the ones that are working as intended and the ones which aren't? It is easier to discuss these things with specific examples and describing what is the intended result. Thanks!

    Regards,

    Victor