RedApparat / Fotoapparat

Making Camera for Android more friendly. 📸
Apache License 2.0
3.81k stars 405 forks source link

Preview "resolution" to match native sensor "resolution" #333

Closed huckw closed 5 years ago

huckw commented 5 years ago

Not an issue, but a question...

I would like to operate on the full "resolution" sensor data in the frameProcessor() callback. By "resolution" I do not mean the pixel count or sensor size, but instead I mean that i want the raw sensor data without decimation. I understand that my sensor pixel count is much larger than my display pixel count...so in order to get the raw sensor data I want I can only get a subset of it that fits the number of pixels in my display. In a way it is like a digital zoom. Is this at all possible with fotoapparat?

dmitry-zaitsev commented 5 years ago

so in order to get the raw sensor data I want I can only get a subset of it that fits the number of pixels in my display

That is not true. Frame size of is bound to the preview size of the camera. Preview size of the camera is not bound to the display size. In fact, we have to crop the preview image so that it fits the device screen.

To answer your problem, you can just set the biggest possible preview size and it will give you preview frames of the highest possible resolution.

huckw commented 5 years ago

On my device when I set preview resolution to biggest the data is 1200x1600 but the sensor is more than 3000x4000 (a captured photo is 3000x4000). So the preview data seems to be a downsampled version of what the sensor sees. I'm looking for a way to get the native sensor data to operate on in the callback....is that possible?

On Thu, Jan 10, 2019, 2:45 AM Dmitry Zaytsev <notifications@github.com wrote:

so in order to get the raw sensor data I want I can only get a subset of it that fits the number of pixels in my display

That is not true. Frame size of is bound to the preview size of the camera. Preview size of the camera is not bound to the display size. In fact, we have to crop the preview image so that it fits the device screen.

To answer your problem, you can just set the biggest possible preview size and it will give you preview frames of the highest possible resolution.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/RedApparat/Fotoapparat/issues/333#issuecomment-453033562, or mute the thread https://github.com/notifications/unsubscribe-auth/ADRqDi_VCA9j5z4NwhbRRdhEHK-ulNoRks5vBwuugaJpZM4Z4g7X .

dmitry-zaitsev commented 5 years ago

Sorry for the late response.

No, unfortunately it is not possible to use full camera resolution for the preview due to the limitations of the camera API. I am not sure why exactly it is not allowed but I would make a wild guess that device is not able to produce preview frames fast enough to achieve an acceptable frame rate.

My suggestion is - try to periodically capture full resolution pictures and process those instead.