Tefa
Tefa

Reputation: 346

How to improve captured image resolution with Camera2 API android?

I am using this project android-camera2-secret-picture-taker to capture image without open camera view, but the captured images is very bad like this enter image description here

any help to make this better?
thanks
[Edit]
I tried other phones and it works fine, I take this bad images on Huawei Y6II only and I don't know why? the phone camera is 13 mpx and works fine with native camera app.

Upvotes: 1

Views: 1571

Answers (2)

mkilmanas
mkilmanas

Reputation: 3485

This is a wildly blind guess, but hey, worth a try.

If you used some code snippet from the web which suggests to get a list of supported image sizes and just pick the first one - well this has backfired for me on Huawei devices (more than one model) because Huawei seems to provide the list in the ascending order of resolution (i.e. smallest-first), whereas most other devices I've seen does that in descending order (i.e. largest-first).

So if this is a resolution issue, it might be worth a check.

Upvotes: 0

Eddy Talvala
Eddy Talvala

Reputation: 18137

Did you issue only a single capture request to the camera device? (No free-running preview or such).

Generally, the auto-exposure, focus, and white-balance routines take a second or so of streaming before they stabilize to good values.

Even if you don't want a preview on screen, you need to request 10-30 frames of data from the camera to start before you save a final image. Or to be more robust, set a repeating request targeting some low-resolution SurfaceTexture, and wait until the CaptureResult CONTROL_AE_STATE / AWB_STATE fields reach CONVERGED, and the AF_STATE field is what you want as well (depends on what AF mode you're using). Then capture your image.

Upvotes: 1

Related Questions