My problem is that I want to find the largest square that contains all faces in an image, then crop image base on this square.
It looks like this (the red square is what I want):
I searched on many questions and found this question is similar to my question, but his way only crop the face on photo.
Is there any suggestions to solve my problem?
P:/s: if the largest square doesn't contain all faces (there are faces outside the square), just don't crop it.
Update: the red square can move around the photo to find matched result. The other thing that I forgot to mention: is there any way to get the good result with the faces and bodies on the photo?