OCRStudioSDK is a C++ library. It includes Java API which is automatically generated from C++ interface by the SWIG tool.
All recognition tools are stored and initialized in a special object — recognition engine. It is created using the appropriate configuration file — an archive file containing everything needed for OCRStudioSDK engine to be created and configured.
Recognition is performed using sessions according to a specific workflow.
A session is a process which involves handling an image or a set of different images of the same object — starting with creation of an image object and ending with extraction of the recognition result.
// C++
std::unique_ptr<ocrstudio::OCRStudioSDKInstance>
engine_instance(ocrstudio::OCRStudioSDKInstance::CreateFromPath(configuration_file_path));
// Java
OCRStudioSDKInstance engine_instance =
OCRStudioSDKInstance.CreateFromPath(configuration_file_path);
Configured OCRStudioSDKInstance is used to spawn an OCRStudioSDKSession which implies recognition methods.
Set the required parameters:
There are two types of sessions:
document_recognition for recognizing document fields;face_matching for determining the degree of similarity of faces in several images;represents one internal engine. A target is simply a string encoding real world document type you want to
recognize, for example, are.id.*. A configuration file can contain settings for several different
target groups.
You can also set optional parameters: target_masks, output_modes and others.
For details, see Session parameters.
Some configuration file options can be overridden by specifying new values in the session parameters used to create a session.
Option values are always represented as strings, so if you want to pass an integer or boolean it should be converted to a string first.
// C++
std::string session_params = "{";
session_params += "\"session_type\": \"document_recognition\", " // Setting document recognition session
session_params += "\"target_group_type\": \"default\", " // Setting default session mode
session_params += "\"target_masks\": \"are.id.*\", " // (optional settings) Enabling id documents of the UAE in a session
session_params += "] ";
session_params += "}";
// Java
String session_params = "{";
session_params += "\"session_type\": \"document_recognition\", " // Setting document recognition session
session_params += "\"target_group_type\": \"default\", " // Setting default session mode
session_params += "\"target_masks\": \"are.id.*\", " // (optional settings) Enabling id documents of the UAE in a session
session_params += "] ";
session_params += "}";
// C++
const char* signature = "... YOUR SIGNATURE HERE ...";
std::unique_ptr session(engine_instance->CreateSession(signature, session_params.c_str(), &optional_delegate));
// Java
String signature = "... YOUR SIGNATURE HERE ...";
OCRStudioSDKSession session = engine_instance.CreateSession(signature, session_params, optional_delegate);
Create an OCRStudioSDKImage object which will be used for processing:
// C++
std::unique_ptr image(ocrstudio::OCRStudioSDKImage::CreateFromFile(image_path.c_str())); // Loading from a file
// Java
OCRStudioSDKImage image = OCRStudioSDKImage.CreateFromFile(image_path); // Loading from a file
Process the image using the ProcessImage(...) method:
// C++
session->ProcessImage(*image);
// Java
session.ProcessImage(image);
Create an OCRStudioSDKImage object which will be used for processing:
// C++
const ocrstudio::OCRStudioSDKResult& result = session->CurrentResult();
// Java
OCRStudioSDKResult result = session.CurrentResult();
Our SDK includes facilities to read RFID chip data for identity documents supporting NFC scanning of documents complying with the international standards (ISO/ICAO Doc 9303 eMRTD). Our SDK can also be used to parse NFC passports and perform document authentication checks if your product configuration supports parsing such data.
The module of our SDK performing RFID reading supports the Android and iOS platforms.