Quick start
In order to perform recognition, you first need to create a concrete recognizer object. Each recognizer object is specific for each object that needs to be scanned. After creating required recognizer objects, you need to create recognizer runner object that will use given recognizer objects to perform recognition of images.
A simple example that uses generic ID recognizer to scan information from any ID document would look like this:
- (Android only) initialize Android JNI context. This is required on Android in order for license validation and resource loading to work.
MB_API void MB_CALL recognizerAPIInitializeAndroidApplication(JNIEnv *env, jobject applicationContext)
Sets the JNI application context to the SDK. This is required in order for SDK to be able to load res...
- (Desktop platforms only) define the location of cache folder. This is required to store some cache files when online licenses are used. On mobile platforms those files are stored into app's private folder, but on desktop platforms it is required to define a unique folder in order to avoid clashes with other applications using the same SDK.
MB_API MBRecognizerErrorStatus MB_CALL recognizerAPISetCacheLocation(char const *cacheFolder)
Sets the location where cache files will be stored on desktop platforms. The given folder may or may ...
- Insert your license key
{
}
MB_API MBRecognizerErrorStatus MB_CALL recognizerAPIUnlockWithLicenseKey(char const *licenseKeyBase64)
Unlocks the SDK with given license key encoded as base64 string. NOTE: This function is not thread sa...
MBRecognizerErrorStatus
Enumeration of all possible error statuses.
Definition: RecognizerError.h:28
@ MB_RECOGNIZER_ERROR_STATUS_SUCCESS
Definition: RecognizerError.h:30
- Set path to folder containing resources required by the library. The function recognizerAPISetResourcesLocation requires absolute path to folder containing all files from "resources/non-android" folder from the distribution on all platforms except Android. On Android it requires relative path to folder within "assets" containing all files from the "resources/android" folder from the distribution.
{
}
MB_API MBRecognizerErrorStatus MB_CALL recognizerAPISetResourcesLocation(char const *resourcePath)
Sets the location where required resources will be loaded from. If not set, "res" folder within curre...
- Create and configure generic ID recognizer
{
}
#define MB_TRUE
True constant for C SDK.
Definition: Types.h:26
#define MB_FALSE
False constant for C SDK.
Definition: Types.h:23
A recognizer that can scan and parse identity cards.
MB_API MBRecognizerErrorStatus MB_CALL blinkIdRecognizerCreate(MBBlinkIdRecognizer **blinkIdRecognizer, MBBlinkIdRecognizerSettings const *blinkIdRecognizerSettings)
Allocates and initializes new GenericIDRecognizer object.
Settings for configuring MBBlinkIdRecognizer.
Definition: IdRecognizer.h:59
MBBool allowBlurFilter
Definition: IdRecognizer.h:61
MBBool validateResultCharacters
Definition: IdRecognizer.h:83
MB_API void MB_CALL blinkIdRecognizerSettingsDefaultInit(MBBlinkIdRecognizerSettings *)
Populate MBBlinkIdRecognizerSettings structure with default values.
MBBool allowUnparsedMrzResults
Definition: IdRecognizer.h:64
MBBool allowUnverifiedMrzResults
Definition: IdRecognizer.h:70
- Create and configure recognizer runner
{
}
void * MBRecognizerPtr
Typedef for pointer to generic Recognizer object.
Definition: Recognizer.h:32
MBRecognizerRunner data structure.
MB_API MBRecognizerErrorStatus MB_CALL recognizerRunnerCreate(MBRecognizerRunner **recognizerRunner, MBRecognizerRunnerSettings const *settings)
Allocates and initializes the recognizer runner object.
Recognizer runner settings data structure.
Definition: RecognizerRunner.h:65
size_t numOfRecognizers
Definition: RecognizerRunner.h:84
MB_API void MB_CALL recognizerRunnerSettingsDefaultInit(MBRecognizerRunnerSettings *)
Populate MBRecognizerRunnerSettings structure with default values.
MBRecognizerPtr const * recognizers
Definition: RecognizerRunner.h:79
Prepare the image to be recognized. Image first needs to be created from from memory. To create image from memory buffer use recognizerImageCreateFromRawImage.
int image_width, image_height, image_stride;
}
MB_API char const *MB_CALL recognizerErrorToString(MBRecognizerErrorStatus errorStatus)
@ MB_RAW_IMAGE_TYPE_BGR
Definition: RecognizerImage.h:53
unsigned char MBByte
Byte type for C SDK.
Definition: Types.h:29
MBRecognizerImage data structure. Holds image on which recognition will bw performed.
MB_API MBRecognizerErrorStatus MB_CALL recognizerImageCreateFromRawImage(MBRecognizerImage **image, MBByte const *input, uint16_t width, uint16_t height, uint16_t bytesPerRow, MBRawImageType rawType)
Allocates and creates MBRecognizerImage object from raw image. NOTE: This function will not make copy...
Alternatively, you can use recognizerImageLoadFromFile to directly create MBRecognizerImage by loading a supported file.
}
MB_API MBRecognizerErrorStatus MB_CALL recognizerImageLoadFromFile(MBRecognizerImage **image, char const *path)
Allocates and creates MBRecognizerImage object from given file. NOTE: Only JPG and PNG file types are...
- Once you have created an image, you can perform recognition using method recognizerRunnerRecognizeFromImage.
{
}
MBRecognizerResultState
Definition: Recognizer.h:39
@ MB_RECOGNIZER_RESULT_STATE_EMPTY
Definition: Recognizer.h:41
MB_API MBRecognizerResultState MB_CALL recognizerRunnerRecognizeFromImage(MBRecognizerRunner *recognizerRunner, MBRecognizerImage const *image, MBBool imageIsVideoFrame, MBRecognitionCallback const *callback)
Performs recognition of given image.
- Obtain result structure from each of the recognizers. If some recognizer's result's state is MB_RECOGNIZER_RESULT_STATE_VALID, then it contains recognized data.
{
}
@ MB_RECOGNIZER_RESULT_STATE_VALID
Definition: Recognizer.h:53
MB_API MBRecognizerErrorStatus MB_CALL blinkIdRecognizerResult(MBBlinkIdRecognizerResult *result, MBBlinkIdRecognizer const *blinkIdRecognizer)
Obtains the result from the given GenericIDRecognizer object.
Result of the MBBlinkIdRecognizer.
Definition: IdRecognizer.h:286
- Finally, when done, clean the memory. Each structure has method for releasing it.
MB_API MBRecognizerErrorStatus MB_CALL blinkIdRecognizerDelete(MBBlinkIdRecognizer **blinkIdRecognizer)
Destroys the given GenericIDRecognizer.
MB_API MBRecognizerErrorStatus MB_CALL recognizerImageDelete(MBRecognizerImage **image)
Deletes the image object and sets pointer to NULL.
MB_API MBRecognizerErrorStatus MB_CALL recognizerRunnerDelete(MBRecognizerRunner **recognizerRunner)
Deletes the recognizer runner object and sets a pointer to it to NULL. Note that recognizers that wer...
Additional info
For any inquiries, additional information or instructions please contact us at help.microblink.com. When contacting, please state which product and which platform you are using so we can help you more quickly. Also, please state that you are using C SDK and state the version you are using. You can obtain the library version with function recognizerAPIGetVersionString.