0

I am modifying (Java) the TF Lite sample app for object detection. It has a live video feed that shows boxes around common objects. It takes in ImageReader frames at 640*480.

I want to use these bounds to crop the items, but I want to crop them from a high-quality image. I think the 5T is capable of 4K.

So, is it possible to run 2 instances of ImageReader, one low-quality video feed (used by TF Lite), and one for capturing full-quality still images? I also can't pin the 2nd one to any Surface for user preview, pic has to be captured in the background.

In this medium article (https://link.medium.com/2oaIYoY58db) it says "Due to hardware constraints, only a single configuration can be active in the camera sensor at any given time; this is called the active configuration."

I'm new to android here, so couldn't make much sense of this.

Thanks for your time!

PS: as far as I know, this isn't possible with CameraX, yet.

1 Answers1

0

As the cited article explains, you can use a lower-resolution preview stream and periodically capture higher-rez still images. Depending on hardware, this 'switch' may take time, or be really quick.

In your case, I would run a preview capture session at maximum resolution, and shrink (resize) the frames to feed into TFLite when necessary.

Alex Cohn
  • 56,089
  • 9
  • 113
  • 307
  • Thank you! Follow up question: I need the live video feed on Tf Lite, so won't (running full-res preview) + (shrinking every frame for TF Lite) be less performant than just taking full-res pics periodically, say once every 10 seconds? – Pranav Kulkarni Feb 26 '21 at 08:13
  • yes, taking a high-rez picture once in 10 sec is cheaper, but ***a)*** it's rare to have inference run at 30 FPS. So, your TFLite feed is usually diluted and ***b)*** there is no way to accurately map the VGA image on such full-rez image. If your scene is dynamic, this uncertainty may cause bad-looking results. – Alex Cohn Feb 26 '21 at 16:14
  • Understood. Thanks a lot! – Pranav Kulkarni Feb 28 '21 at 05:43