Google Glass preview image scrambled with new XE10 release

前端 未结 6 1158
情歌与酒
情歌与酒 2020-12-02 17:44

This occurs using a few apks that make use of the camera (e.g., zxing, opencv). It displays a glitched image in the preview but it is still a function of what the camera se

相关标签:
6条回答
  • 2020-12-02 17:47

    You can set the params.setPreviewSize(1200,800). You can change the values around this range until you can clear color noise.

    0 讨论(0)
  • 2020-12-02 17:52

    This still is an issue as of XE22 (!) Lowering the frames per second to 30 or lower does the trick:

     parameters.setPreviewFpsRange(30000, 30000);
    

    And indeed, don't forget to set the parameters:

    camera.setParameters(parameters);
    

    I have found no clear explanation as to why this causes trouble, since 60 fps is included in the supported fps range. The video can record 720p, but I never saw a source add the fps to this.

    0 讨论(0)
  • 2020-12-02 17:57

    The bug still exists as of XE16 and XE16.11 but this code gets past the glitch and shows a normal camera preview, note the three parameter setting lines and their values. I have also tested this at 5000 (5FPS) and it works, and at 60000 (60FPS) and it does not work:

        public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
            if (mCamera == null) return;
    
            Camera.Parameters camParameters = mCamera.getParameters();
            camParameters.setPreviewFpsRange(30000, 30000);
            camParameters.setPreviewSize(1920, 1080);
            camParameters.setPictureSize(2592, 1944);
            mCamera.setParameters(camParameters);
            try {
                mCamera.startPreview();
            } catch (Exception e) {
                mCamera.release();
                mCamera = null;
            }
        }
    
    0 讨论(0)
  • 2020-12-02 18:02

    30 FPS preview is pretty high. If you want to save some battery and CPU, consider the slowest supported FPS to be sufficient:

    List<int[]> supportedPreviewFpsRanges = parameters.getSupportedPreviewFpsRange();
    int[] minimumPreviewFpsRange = supportedPreviewFpsRanges.get(0);
    parameters.setPreviewFpsRange(minimumPreviewFpsRange[0], minimumPreviewFpsRange[1]);
    
    0 讨论(0)
  • 2020-12-02 18:05

    For anyone using ZXing on their Glass, you can build a version from the source code with the above fix.

    Add the following method into CameraConfigurationManager.java

      public void googleGlassXE10WorkAround(Camera mCamera) {
            Camera.Parameters params = mCamera.getParameters();
            params.setPreviewFpsRange(30000, 30000);
            params.setPreviewSize(640,360);
            mCamera.setParameters(params);
      }
    

    And call this method immediately after anywhere you see Camera.setParameters() in the ZXing code. I just put it in two places in the CameraConfigurationManager and it worked.

    I set the Preview Size to be 640x360 to match the Glass resolution.

    0 讨论(0)
  • 2020-12-02 18:12

    For now, please try adding the following workaround after you acquire the Camera but before you setup and start the preview:

    Camera.Parameters params = camera.getParameters();
    params.setPreviewFpsRange(30000, 30000);
    camera.setParameters(params);
    

    (Or just add the setPreviewFpsRange call to your existing parameters if you're setting others as well.)

    0 讨论(0)
提交回复
热议问题