wonjsohn / google-glass-api

Automatically exported from code.google.com/p/google-glass-api
0 stars 0 forks source link

Images pulled from the camera have the wrong aspect ratio #552

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
1. Find the largest supported camera size that matches the aspect ratio of the 
preview / glass screen
2. Use takePicture to capture a JPEG image

What is the expected output? What do you see instead?
I expect to see an undistorted image with the specified size.  Instead i get an 
image that has been vertically squashed.

What version of the product are you using? On what operating system?
XE18.11

Please provide any additional information below.

I'm attempting to set the image size to match the preview aspect ratio with the 
following code:

      Parameters parameters = mCamera.getParameters();
      // Quirk required for Google Glass
      parameters.setPreviewFpsRange(10000, 10000);
      int previewWidth = mPreview.getWidth();
      int previewHeight = mPreview.getHeight();
      if (0 == previewWidth || 0 == previewHeight) {
        previewWidth = 640;
        previewHeight = 360;
      }

      Iterable<Size> sizes = parameters.getSupportedPictureSizes();
      sizes = CameraUtils.getAspectRatioMatches(sizes, previewWidth, previewHeight);
      Size targetSize = CameraUtils.getBiggestSize(sizes);
      if (null == targetSize) {
        CameraUtils.getBiggestSize(parameters.getSupportedPictureSizes());
      }
      parameters.setPictureSize(targetSize.width, targetSize.height);
      mCamera.setParameters(parameters);

Original issue reported on code.google.com by bda...@saintandreas.org on 23 Jun 2014 at 6:13

Attachments: