Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camera2 API onCaptureComplete() is called but camera state is still CONTROL_AE_STATE_PRECAPTURE

I'm trying to create an app that takes some photos from a service using the camera2 API.

I can get the app to take pictures fine from a fragment based on the Camera2Basic sample.

But when I try move to a service the image doesn't finish capturing properly. It never progresses past the autoexposure precapture state.

I narrowed it down to being some problem with not having a preview. I've put together a test fragment by taking the Camera2Basic code and removing the preview, which results in the same issue.

I put together a test fragment that has the issue, based on the Camera2Basic sample where i've basically just removed code for the preview. Fragment code uploaded here http://pastebin.ca/3182401.

I'm getting the onCaptureCompleted() callback but when i check the camera autoexposure state here, it's still in the CONTROL_AE_STATE_PRECAPTURE state.

It doesn't make sense to me that the capture would be completed if one of the camera states is still in precapture.

Anyone know what might be happening here?

like image 867
user2128112 Avatar asked Oct 06 '15 04:10

user2128112


1 Answers

It's not mentioned in the docs, but onCaptureCompleted is actually called when the request has been sent, not when precapture or autofocus sequence has finished. Camera2Basic relies on preview running constantly, because preview acts as a constant monitor for the camera's state. Without it, you won't know when the precapture sequence actually finishes.

like image 62
virusman Avatar answered Nov 20 '22 10:11

virusman