3 ms·
I worked on an app that we needed to take a live video stream, run that through OpenCV, but also quickly take high-res photos while that's running. On Android
by stickydink 9y ago
I worked on an app that we needed to take a live video stream, run that through OpenCV, but also quickly take high-res photos while that's running.
On Android I really had trouble in getting the preview stream to line up with the photographs. I needed to keep the preview resolution low enough that devices could process it and present to the screen in real time. But not all devices have the same preview and photograph resolutions.
I found there were inconsistencies between the way the image was cropped (on the OS/hardware level) between different resolutions.
You can take a preview stream at resolution X, and it would appear full frame. Then you would take a photograph at resolution Y, and despite being the same aspect ratio, it would be cropped differently. The results varied between devices, with some matching the crop, some vertically, some horizontally, and (as far as I could tell) there was no way to identify programmatically how the camera was doing the cropping. It seemed to be being done at a level much lower than I could access.
In the end we just had to compromise on a resolution in the middle and use it for both preview and photo.
It may not be the reason, and maybe there's a way around this, the project was a year or two since now. Implementing the same thing on iOS I didn't run into the issue.