PAGES

23

Dec 10

WP7 Camera Access–Flashlight, Augmented Reality and Barcode Scanning



[Download Code]

In a special holiday post my gift to you is not one, not 2, but 3 windows phone camera tricks. It’s a mobile ménage à trois.  

1,,) Flashlight

There are lots of those flashlight apps in the marketplace that take about 2 minutes to build. This also took 2 minutes to build but it’s way better because it uses the real light on your phone. (Note: It’s turning on camera recording, but not actually saving anything when it’s done. Not sure what that will do to memory usage if you wonder through a cave with this as your flashlight. Might need to turn it off occasionally)

2) Barcode Scanning

Uses zxing. There was a Silverlight port linked somewhere that I used. Seems to work well for QR codes.  Not so well for other stuff.  The code in there right now should just work. You can use zxing generator to test it out. I’d like to get the 1D barcode scanning to work, but I didn’t have time to see what’s the problem right now.

3) Augmented Reality

Uses the awesome SLARToolkit by René Schulte. Basically his hello world augmented reality app running on the phone. You can use this marker to test it out.

You should just be able to run the xap in the debug folder to try all of this out.  The code is all pretty simple, but a few people have asked about barcode scanning and AR so this should get you started.

If you want to build yourself you need to do a few things since I put the Microsoft.Phone.Media.Extended dll in the GAC.

1. Copy Microsoft.Phone.Media.Extended.dll to C:Program Files (x86)Reference AssembliesMicrosoftFrameworkSilverlightv4.0ProfileWindowsPhone

2. Open C:Program Files (x86)Reference AssembliesMicrosoftFrameworkSilverlightv4.0ProfileWindowsPhoneRedistList FrameworkList.xml and add the line

3. Open a visual studio command prompt and go to C:Program Files (x86)Reference AssembliesMicrosoftFrameworkSilverlightv4.0ProfileWindowsPhone  and type “sn -Vr Microsoft.Phone.Media.Extended dll”

Obviously you’ll need a copy of the Microsoft.Phone.Media.Extended dll.  You can get that from the rom on your phone or from a rom that someone else dumped. 

If you want to build your own app using the camera, make sure to add       to the capabilities in the manifest.

Also I think I contractual obligated to say this, but using the camera in this manner will not pass marketplace certification unless you also include a healthy bribe with your xap.

1 comment , permalink


  • http://

    From the video I can see you are using a newer version. Is this available too? Im not sure how you added the focus?