Appearance
Images
The application can receive the camera image stream from the SDK by implementing ImageListener
, and then pass it to the session builder when creating a session.
The SDK sends an ImageData
object that contains:
- The current image captured by the camera.
- The face or finger detection coordinates, as calculated by the SDK.
- The image validity - whether the image is processed by the SDK or not.
Swift
func onImage(imageData: ImageData) {
DispatchQueue.main.async {
// imageData.image - A UIKit.UIImage object
// imageData.roi - A CGRect object
// imageData.imageValidity - An integer with a value from BinahAI.ImageValidity class
}
}
func onImage(imageData: ImageData) {
DispatchQueue.main.async {
// imageData.image - A UIKit.UIImage object
// imageData.roi - A CGRect object
// imageData.imageValidity - An integer with a value from BinahAI.ImageValidity class
}
}
Objective-c
- (void)onImageWithImageData:(BNHImageData *)imageData {
dispatch_async(dispatch_get_main_queue(), ^{
// imageData.image - A UIKit.UIImage object
// imageData.roi - A CGRect object
// imageData.imageValidity - An integer with a value from BNHImageValidity class
});
}
- (void)onImageWithImageData:(BNHImageData *)imageData {
dispatch_async(dispatch_get_main_queue(), ^{
// imageData.image - A UIKit.UIImage object
// imageData.roi - A CGRect object
// imageData.imageValidity - An integer with a value from BNHImageValidity class
});
}
By default, the SDK processes camera images in a portrait orientation, regardless of the device orientation. Instructions on how to process the camera stream in other orientations can be found at Device Orientation Setup.
Important
Note that images are sent on a background thread. The application must switch to the UI thread in order to perform UI updates.