-1

I'm working on specific app that detect items via MLKit (Android),detection works great, but what would be most optimal way to track for how long specific items was detected.

Like if I detect certain item I want to track how long it was detected for (in seconds). So if it was detected for X seconds, I want to invoke certain activity with that)

enter image description here

1 Answers1

0

You can specify STREAM_MODE when building the ObjectDetectorOptions. In that case, for each DetectedObject, you will also get a tracking Id. Then you can check if the same tracking Id is returned from the ObjectDetector for a certain period of time.

ML Kit provides a sample app containing the functionality of triggering certain logic after detecting and tracking an object for a period of time. That app is more involved, but you may take a look for some reference: https://github.com/googlesamples/mlkit/tree/master/android/material-showcase

Steven
  • 321
  • 1
  • 7