13

I'm feeling cool with these HATS! But how are they showing up with the profile pictures?

What I'm sure about is,

  • It's not attached to the profile picture it self.

  • It is shown over the profile picture.

  • Its shows at the exact place where we've set it. Have you stored (x, y) positions of the hats for this? And also allow us to rotate them, so you must store the degree of rotation?

  • Do some of the hats detect the user's face and set it at particular place? For e.g. 1) A t-shirt (blue or yellow or red) will sit exactly at the right place, where I'd wear my shirt. 2) A cap will set directly on my head.

Is there an algorithm that checks for this and sets it at a particular place accordingly?

0

1 Answer 1

19

Hats are drawn as SVG objects (line drawings), placed in the page with JavaScript code. Their location, size and rotation is stored separately on the server and used by the script to place the hats.

The hats don't detect your face; their default coordinates (location, size and rotation) are just set to very sensible defaults (balpha created these by calculating them from existing portrait avatars), and your avatar just fits that default profile. When I try to place hats, they rarely fit my Ninja immediately, I do have to adjust their coordinates each time.

Even then, the Ninja doesn't always put them on correctly:

Ninja with too big a football helmet

4
  • 4
    I did in fact average a ton of Stack Overflow avatars that are portrait photos; the default hat sizes and positions are based on that average.
    – balpha StaffMod
    Commented Dec 18, 2014 at 9:49
  • @balpha: cool! but the hats are not placed based on the current user avatar though. :-) Commented Dec 18, 2014 at 9:54
  • 6
    No, I felt that running face recognition for the initial placement would have been just a tiny bit of overkill :)
    – balpha StaffMod
    Commented Dec 18, 2014 at 9:56
  • @balpha That would be such a waste of time, I bet face recognition would fail anyway in 80% of the cases with all those crazy avatars like ninjas, dogs and cats on StackOverflow :D
    – Wilt
    Commented Dec 19, 2016 at 7:51

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .