Earlier, we, Smart Engines , have already written about our recognition technologies ( RF passports , bank cards, and many others ). The core value of the SDK is the Smart IDReader “core” or “recognition engine”, which combines the scanning functionality of everything we can scan under a single interface.
The recognition library is written in C ++ for maximum performance, but for use with various programming languages, we have versions of the library interfaces in C ++, C, C #, Objective-C, Java, and even Visual Basic. We support all popular operating systems: iOS, Android, Windows, Linux, MacOS, Solaris and, of course, Elbrus and AstraLinux. Our algorithms are optimized for such architectures as ARMv7-v8, AArch64, x86, x86_64, SPARC, E2K.
We decided to post a demo version of our SDK on Github so that you can familiarize yourself with the library interface (both the Objective-C part and C ++), read the documentation and try to embed Smart IDReader into your application. The repository with the demo version of the Smart IDReader iOS SDK is available at the link: https://github.com/SmartEngines/SmartIDReader-iOS-SDK
To see how Smart IDReader looks like in our performance after embedding, you can download free full versions of applications from the App Store and Google Play .
In this article, we will describe how an iOS developer can use our technologies to add document recognition functionality to their application.
The structure of the iOS SDK that the customer receives and which can be seen in the repository is as follows:
doc
- documentationSESmartID
- Objective-C code GUI wrappers over the C ++ kernel, which interacts withSESmartIDCore/data-zip
- kernel configurationSESmartIDCore/include
- C ++ header filesSESmartIDCore/lib
- universal static library for iOS devices and simulatorsSESmartIDSample
and SESmartIDSample.xcodeproj
- sample project filesAll the iOS code of our SDK, which includes both the code of the main ViewController, and the code of the example of its use, is supplied in its original form, and not in the form of a compiled library. You can use and change it as you like.
To add our SDK to your project, do the following:
Done! The structure of your project at the end may look like this:
The main wrapper class with which you interact is called SESIDViewController. To get recognition results, you must also add the SESIDViewControllerDelegate protocol and the wrapper object to your class as follows:
#import "SESIDViewController.h" @interface SESIDSampleViewController : UIViewController <SESIDViewControllerDelegate> @property (nonatomic, strong) SESIDViewController *smartIdViewController; @end
Then, the recognition engine must be configured:
- (void) initializeSmartIdViewController { // / self.smartIdViewController = [[SESIDViewController alloc] init]; // , self.smartIdViewController.delegate = self; }
Finally, when you want to scan a document, you need to display a recognition screen, specifying which documents you need to recognize in the current session:
- (void) showSmartIdViewController { // , // .. [self.smartIdViewController addEnabledDocumentTypesMask:"rus.passport.*"]; // [self.smartIdViewController addEnabledDocumentTypesMask:"mrz.*"]; // [self.smartIdViewController addEnabledDocumentTypesMask:"card.*"]; // , self.smartIdViewController.sessionTimeout = 5.0f; // [self presentViewController:self.smartIdViewController animated:YES completion:nil]; }
During the scan, you will have two delegate methods that you need to implement to get the recognition result:
// - (void) smartIdViewControllerDidRecognizeResult:(const se::smartid::RecognitionResult &)result { // "" , if (!result.IsTerminal()) { // return; } // [self dismissViewControllerAnimated:YES completion:nil]; // // const std::vector<std::string> &stringFieldNames = result.GetStringFieldNames(); // const se::smartid::StringField &field = result.GetStringField("second_name"); // , const BOOL fieldAccepted = field.IsAccepted(); // NSString *fieldValue = [NSString stringWithUTF8String:field.GetUtf8Value().c_str()]; // : if (result.HasImageField("photo")) { const se::smartid::Image &image = result.GetImageField("photo").GetValue(); self.resultImageView.image = [SESIDViewController uiImageFromSmartIdImage:image]; } } // - (void) smartIdViewControllerDidCancel { // [self dismissViewControllerAnimated:YES completion:nil]; }
We explained how to embed Smart IDReader SDK into your iOS application.
By the way, if you run the Github example and see an unfamiliar woman, do not panic! This is widely known in narrow circles of the developers of Erika Mustermann recognition systems, whose popularity is comparable to the popularity of the famous Lena from image processing articles.
Source: https://habr.com/ru/post/329574/
All Articles