Android Camera API - Weird zoom effect [closed]

2019-03-02 21:30发布

问题:

I am using the android camera API for a project I am working on at the moment and I came across a rather strange behavior. When I change the preview size to go to a higher resolution, I indeed get a much better quality preview but there is also this annoying zoom effect that occurs: Say I am holding my device at 5 cm from a object in 1024x512, I can see it entirely. But if I change to 1920x1080, It's like I've zoomed into the object and I need to go further away to capture it entirely. Now that's a bit disappointing as I want a higher resolution to get more details of my object but if I have to go further away from it then the sensor is not sensible enough to get those details. Is there something I misunderstood with the Camera API maybe?

回答1:

This could be a bug on your side, or a bug (or a feature, if you like) of the camera on your device. To check, register for preview callback (setOneShotPreviewCallback()), save the buffers that you receive in same position for different resolutions, and compare the images.

From my personal experience, going from 4:3 to 16:9 resolution often reduces the field of view. But in your example, both settings keep same aspect ratio.