0

I'm having trouble using MLKit with Unity. What I'm trying to do is get image information from webcamtexture, pass the pointer to a Texture2D, then get raw bytes from it and pass them to a plugin where face recognition classes are. But no faces are being detected.

How should one pass image/camera info from Unity to android and hence use mlkit?

retrogeek46
  • 1
  • 1
  • 2
  • 1
    Welcome to Stack Overflow! We are a question-and-answer site. Please show the code you have tried so far. Also have a look at [How do I ask a good question?](https://stackoverflow.com/help/how-to-ask) and [How to create a Minimal, Complete, and Verifiable example](http://stackoverflow.com/help/mcve). – Rosário Pereira Fernandes Jun 30 '18 at 10:20
  • Have you found any solution? – Sejpalsinh Jadeja Dec 14 '21 at 19:52

1 Answers1

0

Having tried the plugin approach for exactly this scenario myself and winding up in gradle hell on unity side trying to build the project with an android plugin connecting to MLKit while doing so, the only approach that worked for me so far is as follows...

Since MLKit is currently not part of the firebase for unity solution one way you could handle this is to export your unity project to android and set up your MLKit communication from there, i.e. include your MLKit dependencies in gradle, include you're google-services.json in the unity android export, etc. as explained here.

Once you have all that in place you could call the relevant android functions from unity via a C# script passing along the Texture2D byte array for further processing by MLKit Face Recognition.

zippo
  • 1