MLH-Fellowship / class-photo

📷 Discord Bot that downloads, crops photos around everyone's face and creates a collage
MIT License
37 stars 7 forks source link

Image Recognition - Find the largest face #6

Open wrussell1999 opened 3 years ago

wrussell1999 commented 3 years ago

To prevent dodgy crops, pick the largest face in the array and use that. Using the Google Cloud Vision API

wei commented 2 years ago

This snippet below is currently always picking the last face in the faces array:

https://github.com/MLH-Fellowship/class-photo/blob/e281b74bd1e4631fa2d833314bdb49a623ab4985/class_photo/face.py#L46-L47

We should add a conditional here to only set the box variable if the new face width/height is larger than the one stored in box. or just do a sort by width/height and take the largest one.