Skip to main content

Aila_ID1CaptureImage

Captures images of ID-1 sized cards.

Signature

void Aila_ID1CaptureImage(void (^completion)(UIImage *image, NSError *error));

Parameters

  • completion - Block/closure called when capture completes

Description

Captures images of ID-1 sized cards (e.g., credit cards, driver's licenses, health insurance cards) when using Aila's Interactive Kiosk equipped with the ID Tray accessory.

If capture succeeds, the captured image is returned as the image parameter of the completion callback, and the error parameter is nil. If capture fails, the image parameter is nil, and the error parameter is non-nil.

id1CardDetectionMode and AilaID1CardDetectedNotification may be used to automatically detect the presence of a card.

Error Domains

AilaID1ImageCaptureTimeoutError

This error occurs when a clean image could not be captured within 10 seconds, due to any of the following causes:

  • Unable to achieve correct camera focus
  • Unable to achieve correct exposure (Note: the Aila Interactive Kiosk supplies enough light to operate without ambient lighting, but if the hardware is unpowered or lighting levels have been overridden, low exposure may occur)

Usage

// Enable card detection
AilaConfiguration *config = [[AilaConfiguration alloc] init];
config.id1CardDetectionMode = AilaID1CardDetectionModeOn;
Aila_SetConfiguration(config);

// Listen for card detected
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(handleCardDetected:)
name:AilaID1CardDetectedNotification
object:nil];

// Capture when card is detected
- (void)handleCardDetected:(NSNotification *)notification {
Aila_ID1CaptureImage(^(UIImage *image, NSError *error) {
if (error) {
NSLog(@"Capture failed: %@", error.domain);
} else {
NSLog(@"Captured image: %@", image);
// Process the captured image
}
});
}

See Also