Menu

Live Hair Colour Try-On, Entirely on the Phone: MediaPipe in a WebView Inside Flutter
📰

Live Hair Colour Try-On, Entirely on the Phone: MediaPipe in a WebView Inside Flutter

DEV Community: flutter·Gabriele Pieretti·4 days ago
#2DAtmTcW
#devtoflutter#devto#dev#hair#engine
Reading 0:00
15s threshold

In the Miraviso Colore app you point the front camera at your face, tap a copper brown, and your hair turns copper brown while you move your head. No frame leaves the phone. Put like that it sounds like a filter app feature. Doing it properly, on an ordinary Android phone and with a privacy promise you can check by watching the network, took more rounds than I had planned for. This is the engine as it stands today, with the numbers I measured.

Why there is a browser inside a Flutter app

The first thing that surprises people who open the code: the try-on does not use tflite_flutter , there is no Kotlin plugin and no Flutter shader. The screen is a WebViewWidget , and inside it runs a page with MediaPipe Tasks Vision in WebAssembly and a WebGL2 fragment shader.

The engine started life as a browser prototype and found its shape there. Porting it to Dart would have meant rewriting the segmentation, the shader and every fix described below, to end up with the same result.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.