The Camera API and Geolocation Exif Data on AIR for Android

Posted by magician | Posted in Web | Posted on 19-10-2010

1

As part of my MAX session, I’ve been playing around with the camera API and wanted to pull some of the Exif data around geolocation. My first thought was that I could use the geolocation APIs in AIR to inject Exif data into the image from the camera. But the way that the AIR for Android Camera API works (which makes sense) is that when you take a picture, it creates a MediaPromise, which is a new class in AIR for Android that is similar to a FilePromise. That code includes a bunch of Exif data that Android adds. The only issue with the GPS coordinates are that they’re in sexagesimal format and need to be converted into decimal.

There are actually two ways to get images into your AIR application. The first is using the flash.media.CameraUI class. That brings up the camera controls and lets the user take a picture directly. When the user clicks “OK” on the camera, it saves the file to the SD card and then passes the file reference back to AIR where you can program an event handler to respond:

public var cameraUI:CameraUI;
 
protected function onCreationComplete():void
{
 
if(CameraUI.isSupported)
{
cameraUI = new CameraUI();
cameraUI.addEventListener(MediaEvent.COMPLETE,onComplete);
}
 
}

Then all that has to be done is to call the launch() method and that pops up the camera controls. When the user confirms the photo, the MediaEvent.COMPLETE handler deals with the photo. Or in this case, the file reference.

protected function btn_clickHandler(event:MouseEvent):void
{
cameraUI.launch(MediaType.IMAGE);
}

The other way to get access to photos is to pull them from the phone’s memory. You can do that with the flash.media.CameraRoll API. It’s a very similar process to the CameraUI. Instead of a complete event, listen for a select event, and to bring up the library of images, call the browseForImage() method.

public var cameraRoll:CameraRoll;
 
protected function onCreationComplete():void
{
if(CameraRoll.supportsBrowseForImage)
{
cameraRoll = new CameraRoll();
cameraRoll.addEventListener(MediaEvent.SELECT,onSelect);
}
}
 
protected function btn_clickHandler(event:MouseEvent):void
{
cameraRoll.browseForImage();
}

Now once the image has been taken or selected, we can pull the Exif data from it. Both the complete event and the select event will look the same because they both create a MediaPromise. I’m using the Exif library here, which uses the load() method and an event handler to deal with the Exif data when it loads.

protected function onSelect(event:MediaEvent):void
{
var request:URLRequest = new URLRequest(event.data.file.url);
var exif:ExifLoader = new ExifLoader();
exif.addEventListener(Event.COMPLETE,onExifComplete);
exif.load(request);
}

The parsing of the Exif data is pretty straightforward. Once it has been parsed, pulling out the specific tags by name for Latitude and Longitude, all that is left is to convert the sexagesimal latitude and longitude to decimal degrees.

protected function onExifComplete(event:Event):void
{
var exif:ExifInfo = event.currentTarget.exif as ExifInfo;
var gpsIfd:IFD = exif.ifds.gps;
 
// get the array of GPS coordinates from the Exif data
var exifLat:Array = gpsIfd["GPSLatitude"] as Array;
var exifLon:Array = gpsIfd["GPSLongitude"] as Array;
 
// get the decimal degrees for latitude/longitude
var latitude:Number = convertSexagesimalToDecimal(exifLat[0],exifLat[1],exifLat[2],gpsIfd["GPSLatitudeRef"]);
var longitude:Number = convertSexagesimalToDecimal(exifLon[0],exifLon[1],exifLon[2],gpsIfd["GPSLongitudeRef"]);
}
 
protected function convertSexagesimalToDecimal(degrees:int,minutes:int,seconds:Number,reference:String):Number
{
// do the conversion to decimal degrees
var decimal:Number = degrees + (minutes/60) + (seconds / 3600);
 
// figure out whether we need to use negative latitude or longitude
if(reference == "S" || reference == "E")
{
return decimal * -1;
} else {
return decimal;
}
}

So that’s a crash course in using the camera API on AIR for Android and then extracting decimal degrees out of Android’s existing Exif data.

View full post on Digital Backcountry – Ryan Stewart’s Flash Platform Blog

Canon EOS 7D digital camera review

Posted by magician | Posted in Technology | Posted on 06-12-2009

1

Original article: Canon EOS 7D digital camera review
From Machines that go Bing

Canon’s EOS 7D has been around since September so time for a belated hands-on test of its abilities. We got hold of the EOS 7D along with the EFS 18-135mm lens and put it through its paces at Rickmansworth Aquadrome and Oxhey Woods.

Canon EOS 7D

The EOS 7D slots between the EOS 50D and the EOS 5D MkII in terms of price and features. In fact, its very similar to the 5D MkII on features except that it uses a smaller sensor (5184 x 3456 against 5616 x 3744). The EOS 7D is priced at up to $1700 while the 50D is around $1000 and the 5D MkII: $2700.

The main features of the EOS 7d are:

  • 18MP APS-C crop sensor (new design)
  • Continuous shooting at up to 8 fps
  • Multi-axis cross-type 19-point AF grid
  • 100% viewfinder with 1x magnification
  • Environmental sealing
  • LP-E6 battery (same as EOS 5D MkII)
  • HD video at 1920 x 1080 pixels with frame rates of 24, 25 and 30 fps
  • Dual Axis Electronic Level
  • Integrated wireless speedlite control
  • Manual control of aperture in HD movie mode.
  • ISO 100-6400 plus “H” (12800)
  • iFCL metering includes a 63-zone dual-layer metering sensor that reads both illumination and color

Controls

Canon EOS 7D

The top screen and dials are in a layout familiar to most Canon camera users and consists of a 10-position dial with the following modes:

  • C1, C2, C3 – Custom modes allow registration of most of the camera functions, so, for example, you can set C1 to Aperture Priority, ISO 800, Highlight Tone Priority on, Spot metering and Single Shot AF
  • B – Bulb
  • M – manual
  • Av – Aperture Priority
  • Tv – Shutter Priority
  • P – Auto (intelligent) program mode sets aperture and shutter speed, but leaves all other camera settings up to the user
  • CA – creative auto is similar to the green square mode (in fact it defaults to it), but you can bias exposure towards larger or smaller apertures, darker or lighter images
  • [] = Green Square -  is basically a “point and shoot” mode where the camera sets everything for you

Canon EOS 7D

On the right of the camera is the monochrome LCD (which can be illuminated), along with buttons for:

  • ISO selection/FEC (flash exposure compensation)
  • AF/Drive mode setting and metering mode/white balance setting.

With any one button the main control dial (near the shutter release) sets one parameter while the rear QCD (Quick control dial) sets the other.

Most of the rear of the camera is taken up by the three-inch LCD screen as well as the QCD (the large dial to the right). The button above the QCD acts like a miniature joystick and is used to navigate through the various menus. Near the view-finder is a start/stop button which in camera mode starts and stops LiveView mode (the ability to use the LCD screen as a viewfinder) and in video mode starts and stops recording and playback.

Five buttons down the left hand side of the camera back are:

  • Menu – this brings up the camera control menus
  • Picture Style – This allows selection of a picture style setting
  • Info – This cycles through various information displays which can overlay or replace an image
  • Playback – used to recall and image or movie
  • Delete – used to delete files

Autofocus

Canon EOS 7D

Canon has introduced a completely new AF system for the EOS 7D. Its a 19-zone system divided into three regions the centre of which is a high precision sensor based on the AF system of the EOS 5D which can also detect horizontal and vertical lines. The basic AF system requires lenses of f5.6 and faster and the high-precision system requires f2.8 or faster.

In auto mode the EOS 7D can either select from all 19 AF zones or the user can restrict the camera to one or more of the regions (right, left, top, bottom, centre). Using the custom function III-12 different region selections can be used for different camera orientations.

the EOS 7D introduces “Spot AF Mode” which allows the user to select any of the 19 zones and reduce the size down to a smaller area to further restrict the autofocus area. The 7D also has focus point expansion previously only available on 45-point models such as the 1D. This allows one point to be the primary autofocus point but surrounding points are also used.

Resolution

The EOS 7D has the highest pixel density of ant APS-C DSLR, which is to say it has the highest pixel count (18MP) and the smallest pixels (4.3 micron pixel pitch). This is theoretically great for cropping but may result in more noise. The images below show an example of tight  cropping (click on any of the images below for the full-size version)

Canon EOS 7D test image

Canon EOS 7D test image

Canon EOS 7D test image

In use

In general landscape or portrait images the EOS 7D had no trouble making sense of the scene and focussing accordingly.

Canon EOS 7D test image

Canon EOS 7D test image

Canon EOS 7D test image

Canon EOS 7D test image

Zooming in on the higher branches in this image we can see that the autofocus seems to have compromised between some of the nearest objects as the primary focus point as none are particularly sharp.

Canon EOS 7D test image

Conclusions

The most significant feature of the EOS 7D is the autofocus system although our tree photo seems to have caught it out. The new 19-point system incorporates features that will appeal to those doing action or macro-photography. The 7D also features upgrades to the metering, processing, optical viewfinder, and flash system.

The new 18 megapixel CMOS sensor and expanded ISO range produce virtually no visible noise at all from ISO 100 all the way up to ISO 1600 so Canon has managed to increase image quality despite the relatively small sensor.

For the ‘prosumer’ camera buyer the Canon EOS 7D probably has every feature you would want for the next few years and even that wouldn’t be enough to discover everything it can do. The EOS 7D occupies a slot between the EOS 50D and the EOS 5D MkII but given the feature advantage over the MkII and the likely lowering of the price in the near future the Canon EOS 7D is going to be a ‘must buy’.

Related Posts:

View full post on Machines That Go Bing!

Powered by Yahoo! Answers