-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Impossible to take a picture with a good resolution using the font facing camera. #19
Comments
The tricky thing about choosing the camera resolution is that the aspect ratio of the preview needs to be about the same as the aspect ratio of the picture, otherwise you'll end up with a distorted preview image. My guess is that the only supported preview/picture sizes that are close enough in aspect ratio for the Nexus 5 front facing camera hardware is 320x240 (preview) and 320x240 (picture). It's possible that the code is too conservative about how different the preview vs. picture aspect ratios can be. I'd suggest printing out the sizes from the code below and seeing if there is a preview / picture size pair of about the same aspect ratio that you think it should be using, but is not. Let me know if this is the case. You can see what the supported preview sizes and picture sizes are for the Nexus 5 like this:
|
Sorry, that seems to be a bug in CameraSource. We will take a look. |
Thanks ! |
I'm also running into this problem. CameraSource.takePicure results in an image with size 1280 x 720 on my Nexus 6 but my Nexus 9 returns an image with size 320 x 1xx (I don't have the exact resolution at hand but its waaay to small) Thanks! |
My Nexus 6 also takes images with a resolution of 240 x 320 (portrait) from both the front and the back facing camera. Same issue with the back facing camera. |
I managed to hack together a quick fix/hack. |
@Syzygy2048 - the CameraSource source code has been included with the barcode reader sample, so you can use it directly vs. using reflection. |
@saiimons The open source version of CameraSource (see above) includes a fix for selecting the resolution. By default, this will select the highest resolution for taking the picture (that also matches the preview aspect ratio). Note that the current Google Play Services version of CameraSource does not yet have this fix, but that will be corrected in a future release. |
Update: |
@pm0733464 Can You Provide us link!! |
No changes to your code are required. Taking a picture with CameraSource in Google Play Services 8.4 will automatically use the highest resolution that the camera supports (which is same aspect ratio of the preview image). |
I have the same problem on Moro G3 and Sony Xperia C4. What is the way to fix it? |
I've set setRequestedPreviewSize(640, 480) to cameraSource and I've checked the supportedPreviewSizes and supportedPictureSizes of both the front and back cameras: the 640x480 is supported. Nevertheless I always receive pictures of size 2576x1932... |
Well, I analyzed in depth the code and, as you say, it selects the picture size of high resolution available, although the preview size is 640x480. |
When setting a resolution in the preview, such as 1280x960 on a Nexus 5, the output resolution is 320x240.
The camera is set up this way:
And the picture is taken this way:
You can find the modified sample code to help reproduce the issue here
The text was updated successfully, but these errors were encountered: