Lagginess at camera startup and after taking a photo
albullington opened this issue · 3 comments
Here's an Android video from @tiwane, which shows a few second lag between taking a photo and actually freezing the camera frame. This makes it easy for a user to accidentally move the device and save a blurry photo.
I'm inclined to think this can be solved in native code since it's not happening on iOS, but it's also possible the RN bridge is just slower on Android.
The video also shows another potential area for improvement -- it takes about a second for the camera preview to show up when first opening the camera. Something Alex mentioned makes me think this could be laggy because of the time it takes the model to load. If so, we might want to experiment with loading the model at app launch and then hooking into the loaded model every time the camera starts (instead of launching the camera, then loading the model). The lag is definitely more noticeable on Android devices.
The two improvements that would be great here (lmk if these should be separate issues):
- Decrease the time it takes to freeze the camera preview after taking a photo
- Decrease the time it takes to show the camera preview after launching the camera screen
Hi I am encountering the same bugs.
On my phone it takes about 3 seconds for the camera preview to show up when first opening the camera.
I think it has become worse lately.
I think the model loading you mention only explains the second issue, not the first.
Moving the loading of the model to app launch doesn't sound very appealing, since a slow loading app is annoying as well.
I have no idea how it is currently implemented so this might not make any sense at all..
But would it be possible to separate the model loading and camera preview part?
That way you can immediately see the preview. And while the model is still loading, you can point your camera at the animal/plant/insect. This way the loading would be less noticeable.
It would also solve the problem of the image capture delay, since the process of the model and the camera are independent, you don't have to wait on the model doing the prediction calculation (assuming that's what the app is doing) and you can just use the current image preview and the most recent prediction.
Good luck with finding out what the problem is ;)
We are in the process of migrating the camera component to use https://github.com/mrousavy/react-native-vision-camera instead of https://github.com/inaturalist/react-native-inat-camera
Comparing the current new camera implementation to the inat camera the lag is less apparent already. So, closing this off here but feel free to re-open on the Seek repo directly.