Barcode Scanner for Google Glass

2,271 views
Skip to first unread message

Sean Owen

unread,
Apr 26, 2013, 8:27:05 PM4/26/13
to zx...@googlegroups.com
For what it may be worth -- and with a big hint to those who may be involved with Google Glass and devs -- I've adapted the Barcode Scanner scanning to work with Google Glass's APIs. The function is pretty simple now. You enable the app, then share an image with it, and it returns the contents on your timeline. Products get product results, etc.

Not having the glasses or access to the API, it's not quite tested yet, but will be happy to make it available once it can be properly tested.

Sean Owen

unread,
May 8, 2013, 4:05:15 PM5/8/13
to zx...@googlegroups.com
There's not much more to say right now, both because it is simplistic now and because I have no way of testing it. But if anyone has Glass and is willing to try it, report what happens, etc., it might just be ready.

Conceptually all that's happening is that it inserts a contact that you can share images to. Server-side it decodes the image and posts a result to your timeline with info, prices, etc.

Sean Owen

unread,
Jun 10, 2013, 4:21:20 AM6/10/13
to zx...@googlegroups.com
I realized that it may be impossible to test this until *I* have access to the Mirror API, and that only happens when my account gets whitelisted for it, by having this myself.

You can go to https://bsplus.srowen.com/start right now and it will let you add the app but it won't do anything else.

If anyone has Mirror API access maybe we could find a way to test this by taking advantage of that access.

Michael Yin

unread,
Dec 3, 2013, 10:26:36 AM12/3/13
to zx...@googlegroups.com
I built the 2.3.0 apk with some xml additions to add a voice trigger for google glass. This allows it to show up in the "ok glass" menu as well as accessible via voice command, which is all you really need to start up an activity. However, the camera ends up distorted and as such never ends up being able to scan a barcode. Attached is a screenshot of what it looks like (I'm attempting to look at a zxing appspot generated barcode).

I want to use QR codes as a form of user input since there is no keyboard. For now, I'm going to mess with using the android-integration library.

-mike
device-2013-12-03-101409.png

Michael Yin

unread,
Dec 3, 2013, 11:15:23 AM12/3/13
to zx...@googlegroups.com
It appears that all that was needed was to set a valid PreviewFpsRange. I'm unsure why it couldn't just default to one, but adding
parameters.setPreviewFpsRange(30000, 30000);
to line 124 of CameraConfigurationManager.java did the trick. I'd be happy to submit a quick diff to just pick the fastest available previewfpsrange for API >=9. Unless it'd be prudent to choose something closest to 30fps?

Sean Owen

unread,
Dec 3, 2013, 11:40:32 AM12/3/13
to zx...@googlegroups.com
That's weird. At first glance it looks like the preview size is wrong or something.

I'm always reluctant to add any new camera configs even when it seems 100% safe -- like setting the value to a supported value. Trust me, it will make some camera fail.

But maybe we can at least test it out, yeah, as a beta build.

Dale Galiniak

unread,
Dec 7, 2013, 1:51:57 PM12/7/13
to zx...@googlegroups.com
Sorry if this is a dumb question, or if I should post this somewhere else, but how do I compile your code to run it on the Google Glass?  I have iOS development experience, but the Glass is my first foray into android development.

Thanks!

Sean Owen

unread,
Dec 7, 2013, 1:57:13 PM12/7/13
to zx...@googlegroups.com
You can just compile it like anything else with 'mvn compile' but in fact this is complicated to understand. The mirror API is totally web based so you're building a web server that the devices talk to via web callbacks. There's a newer API for building actual Android-like apps for the device. This is the former. I honestly don't know if it works; it's there just for anyone that cares. I think this will ultimately be deprecated as I am not sure the mirror API is going to stay.

Dale Galiniak

unread,
Dec 7, 2013, 5:24:01 PM12/7/13
to zx...@googlegroups.com
So this is a mirror api call, and not a native app.  I was hoping to get this to work natively (I'm also a bit skeptical on the mirror api, it's a lot like the whole "web apps" of the iPhone v1.0), but it looks like I got more work to do to get them working as is.

Thanks!

Sean Owen

unread,
Dec 7, 2013, 5:53:37 PM12/7/13
to zx...@googlegroups.com
Well the barcode app itself may work with Glass directly. I hope so, or at least with just minor work. See other threads about it here.

Sean Owen

unread,
Dec 7, 2013, 5:54:47 PM12/7/13
to zx...@googlegroups.com
Here's a maybe more robust version:

      List<int[]> fpsRanges = parameters.getSupportedPreviewFpsRange();
     
if (!fpsRanges.isEmpty()) {
       
// Largest max FPS:
       
int[] range = fpsRanges.get(fpsRanges.size() - 1);
       
int minFPS = range[Camera.Parameters.PREVIEW_FPS_MIN_INDEX];
       
int maxFPS = range[Camera.Parameters.PREVIEW_FPS_MAX_INDEX];
        parameters.setPreviewFpsRange(minFPS, maxFPS);
     
}


Michael Yin

unread,
Dec 7, 2013, 6:59:17 PM12/7/13
to Sean Owen, zx...@googlegroups.com
So, the parameters initially retrieved from the camera via getParameters() does list a previewfpsrange of 60,60fps. Looking at the google code issues, it appears that it's some sort of known issue with the default parameters in the glass.

I'm not positive that setting max will work properly :( so I've just been hardcoding it at 30, 30 with whatever previewsize the barcode app wants to set, and that works. It's probably worth waiting until that's fixed rather than hardcoding a device specific solution in zxing app, which I haven't submitted any diffs like I said I would.



--
 
---
You received this message because you are subscribed to a topic in the Google Groups "zxing" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/zxing/DjkgCBr2Ehc/unsubscribe.
To unsubscribe from this group and all its topics, send an email to zxing+un...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

cristian....@gmail.com

unread,
Feb 1, 2014, 6:23:46 PM2/1/14
to zx...@googlegroups.com
I will test it as soon as I receive them.  This is the type of applications I would like to work on

I will keep u posted
.


On Friday, April 26, 2013 7:27:05 PM UTC-5, Sean Owen wrote:
Reply all
Reply to author
Forward
0 new messages