This side of the family finds no occasion too small to bring out the Balkan props, like this Lika cap my brother is wearing in the photo. More often than not it's accompanied by the rakija we've collected from relatives in our trips to the Balkans over the years. The whole thing is actually an interesting story that's resulted in some colorful anecdotes and heart-warming stories over the years.
This winter my brother and I decided to grow mustaches together. He led the way with an earlier start in November. The end result accentuated the Likan headwear perfectly. No doubt our Serbian relatives will be pleased when this thing inevitably makes its way to Facebook.
This sketch set out to do a few things:
- Experiment with the Shape Detection API to find faces in the image
- Use p5.js to highlight the faces via the browser Canvas API. I thought it would be fun if the faces were in color while the rest of the image was left in grayscale.
- Highlight the mouth/mustache area around all the captured faces and label my brother and I's mustaches using one of the more enjoyable and vowel-deficient Serbian words I've picked up: brka!
The last part didn't exactly pan out. The landmark locations (i.e. eyes, nose, mouth) are identified in the object returned by the API. Coordinates for each landmark are provided as an array. I'd seen other examples that placec points at these coordinates and the general result is you can see a decent outline of where the feature is on the face.
In all of my tests though the points seem to collect in the middle of the face, almost randomly. The examples I followed are all very straightforward, so I don't think I've overlooked anything. The pixel coordinates for each landmark are different and perhaps very generally located in the directions you'd expect them to be relative to one another, but the vary by a very small handful of pixels. This behavior seemed consistent with every image I tried.
So, after a wall, I chocked it up to bugginess and probably one of the reasons enabling this feature is buried in the
chrome:flags page and turned off by default. Maybe some day I'll come back to this sketch and it will start working.
In the meantime I did the next best thing: made a general guess about where the eyes should be, blacked them out like it was a redacted document and added silly texdt between each of our detected faces to assert thte title Dva Brata i Dva Brka lived up to its name: jedan brata i jedan brka, each.