Is there a way to get a timestamp of when the Android Camera Preview Frame was captured?
I am doing some heavy image processing in real time, and the small errors when added together are a real problem.
Callback interface used to deliver copies of preview frames as they are displayed. See also: Camera. setPreviewCallback(Camera. PreviewCallback)
This package is the primary API for controlling device cameras. It can be used to take pictures or videos when you are building a camera application. Camera. This class is the older deprecated API for controlling device cameras.
The only way I know to do this is use a SurfaceTexture instead of the preview callback.
The SurfaceTexture has a getTimestamp() method that returns nanoseconds since some unspecified (but constant) time.
Unfortunately, the SurfaceTexture is an OpenGL external texture, so it's not as easy to work with the preview callback.
On the other hand, it's substantially more CPU efficient: The preview callback does color conversion and image reshaping in software, whereas one can use the OpenGL ES2 features to do significant amounts of image processing on the GPU.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With