1

I have created a simple app that integrates zxing scanner. When the app runs on any tablet, the scanner view is displayed properly. However, when I run the same code on Glass, the background for the scanner view is displayed with different color bars:

Snapshot of scan view for Glass

I am wondering if I missed something. Regards.

Peter
  • 11,260
  • 14
  • 78
  • 155

3 Answers3

0

Google Glass still has some problems with its camera driver. In particular it does not actually support high frame rates and high preview resolution at the same time. If set too high you see strange artifacts like this.

I have successfully used 1280x720 preview and a modest frame rate. See

https://github.com/zxing/zxing/blob/master/glass/src/com/google/zxing/client/glass/CameraConfigurationManager.java

Sean Owen
  • 66,182
  • 23
  • 141
  • 173
  • Thanks Sean. I compared your code with the git one. Looks like it has changed quite a lot since you last used it. In any case, stepping through the code, it appears the resolution being set is 640x360 in Glass. – Peter Jun 24 '14 at 22:09
  • Compared with what git version? Glass version? This works on XE18.11. – Sean Owen Jun 25 '14 at 06:44
0

This is the solution I used to make the camera work, using 30 fps and a size of 640 by 360

Camera.Parameters parameters = camera.getParameters();
parameters.setPreviewFpsRange(30000, 30000);
parameters.setPreviewSize(640,360);
camera.setParameters(parameters);

It sets the frames per second to 30fps, the problem you are experiencing is a too high framerate like stated above

0

Sean was almost right. However, the problem was not the size but the fps. I got the workaround from another post Google Glass preview image scrambled with new XE10 release.

The trick is to add the following line in CameraConfigurationManager.java just before the call to camera.setParameters(parameters):

parameters.setPreviewFpsRange(30000, 30000);

This makes it work on both tablet and Glass.

Community
  • 1
  • 1
Peter
  • 11,260
  • 14
  • 78
  • 155