A team of highly qualified computer vision experts committed to support you develop the optimal solution

Developer Resources

On this page you will find all resources you need to integrate and use our RapidInput SDK and the different feature. If this still is not enough or if you are looking for a feature that isn’t supported yet, please contact us and let us know what you need. Our team is fully committed to support you get most out the SDK and develop the best possible solution for your business.

RapidInput Get SDK

Downloads

How to integrate the SDK

To integrate the RapidInputMRZ library into an iOS application the following steps in Xcode editor are needed:

1) import libRapidInputMrz.a into Supporting Files in the application workspace, and import related header files,

2) import libjpeg.a into Supporting Files in the application workspace,

3) extract opencv2.framework.zip and load it as a framework in Build Phases (Link Binary with Libraries – where you add UIKit.framework, CoreGraphics.framework and other frameworks),

4) do the same as described in (3) with leptonica and tesseract frameworks and add tessdata folder to the Supporting Files group – take care to use Folder References option (instead of Groups) when importing (you will recognize if the setting was correct by blue folder icon (instead of yellow) which will appear after importing).

5) At the end, your project need to have the following frameworks: CoreData.framework, CoreLocation.framework, UIKit.framework, leptonica.framework, opencv2.framework, tesseract.framework, CoreMedia.framework, CoreGraphics.framework, AVFoundation.framework, CoreVideo.framework

6) Add FragmentShader.fsh and VertexShader.vsh files to the project root

7) Add piwiktracker.xcdatamodelId to the Resources folder (be careful that piwiktracker.xcdatamodelId is package (has 2 files), so the best way to add it is to drag-and-drop it from finder)

8) Example code is given below, most important steps are to initialize recognition:
appDelegate.rapidInputVin.initialize(false, logLevelArg: 3, clArg: callbackListener)

Initialize OpenGL view:
videoPreviewView = appDelegate.rapidInputVin.initializeGl(true, wArg: w, hArg: h, clGlArg: glCallbackListener)

videoPreviewView is an UIView control which can be added to your ViewController with:
self.view.insertSubview(videoPreviewView, atIndex: 0)

Api classes and its callbacks can be wrapped in Objective-c classes.

AppDelegates

var rapidInputVin: RapidInputWrapper!

func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {

rapidInputVin = RapidInputWrapper()
return true

}

func applicationWillTerminate(application: UIApplication) {

rapidInputVin.stopCamera()
rapidInputVin.shutdown()

}

ViewController

var callbackListener:CallbackListenerObjC = CallbackListenerObjC()
var glCallbackListener:CallbackListenerOpenGLObjC = CallbackListenerOpenGLObjC()

var appDelegate = UIApplication.sharedApplication().delegate as! AppDelegate
var inputXmlPath = “”;

override func viewDidLoad() {

super.viewDidLoad()

self.navigationController?.navigationBar.hidden = true
callbackListener.setLabel(lab1)

// CALLBACK WRAPPERS

appDelegate.rapidInputVin.initialize(false, logLevelArg: 3, clArg: callbackListener)

var w = Int32(self.view.bounds.width)
var h = Int32(self.view.bounds.height)
videoPreviewView = appDelegate.rapidInputVin.initializeGl(true, wArg: w, hArg: h, clGlArg: glCallbackListener)
self.view.insertSubview(videoPreviewView, atIndex: 0)

 // INIT RECOGNITION

// INIT OPENGL VIEW

appDelegate.rapidInputVin.startCamera(false)

if let appFolder = getApllicationDocumentFolder() {

inputXmlPath = appFolder.stringByAppendingPathComponent(“inputXml.xml”);

let nsFileManager = NSFileManager.defaultManager()
if !nsFileManager.fileExistsAtPath(inputXmlPath) {

inputXmlPath = “”

}

}
else {

inputXmlPath = “”

}

}
@IBAction func buttonCaptureTap(sender: AnyObject) {

if (self.buttonCapture.titleLabel?.text == “Start”) {

self.buttonCapture.setTitle(“Stop”, forState: nil)

 // START STREAMING

// SET XML PATH

appDelegate.rapidInputVin.startRecogntion(inputXmlPath, zoomArg: 1, xArg: 0, yArg: 0, wArg: 1920, hArg: 1080)

lab1.textColor = UIColor.blackColor()
lab1.text = “Processing…”

} else {

lab1.textColor = UIColor.blackColor()
lab1.text = “”
self.buttonCapture.setTitle(“Start”, forState: nil)

 // START RECOGNITION

appDelegate.rapidInputVin.stopRecognition()
}

}

 // STOP RECOGNITION

RapidInput SDK – Public Interfaces (MRZ only)

#ifndef RAPIDINPUT_H

#define RAPIDINPUT_H

#include “public_types-h”

namespace dacuda

{

 

class rapidInput

{

public:

        rapidInput();

        ~rapidInnput();

//! @brief Class with rapidInput interface

 

//! @brief Internally used to share data among different engine parts

Recognition engine

void initialize(ConfigEngine config = ConfigEngine());

void shutdown();

void startRecogntion(ConfigRecognition config = ConfigRecognition());

//! @brief Initializes the SLAM Scan Mobile Core

//! @brief Shuts down the SLAM Scan Mobile Core

//! @brief Starts the recognition process

//! @param config Contains the parameters to be used to recognize strings

//! In order to have a live rendering (default recognition mode for instance)

//! initGl() must be called before startRecognition()

void stopRecognition();

bool isRecognizing();

//! @brief Cancels the recognition process

//! @brief Returns true if current state is ‘recognizing’

Camera related methods

void startCamera(ConfigCamera config = ConfigCamera());

void stopCamera();

void enableTorch();

void disableTorch();

void captureSnapshot();

//! @brief Starts the camera of the mobile device.

//! @brief Stops the camera of the mobile device.

//! @brief By default the torch is off. This method can enable the torch light.

//! @brief By default the torch is off. This method can disable the torch light.

//! @brief Takes a snapshot from the camera. Only works in state “CameraRunning”.

OpenGL related methods

void * initGl(ConfigRendering config = ConfigRendering());

//! @brief Initializes the OpenGL context of the recognition engine

//! This method returns UIView which will be used to display OpenGL textures – render images from camera and library

void cleanGL();

void draw();

//! @brief Cleans OpenGL resources allocated by the recognition engine

//! @brief Sends a draw request. The engine will draw current

//! situation in the OpenGL context. The app can call this function after receiving

//! the requestDraw() notification from CallbackListenerOpenGL.

//! with ConfigRendering.autoDraw == true the engine will do this automatically.

General methods

std::string getLibraryVersion();   

//! @brief Get version of the library

    };

}// namespace dacuda

#endif // RAPIDINPUT_H

RapidInput SDK – Public Data Types

#ifndef RAPIDINPUT_PUBLIC_TYPES_H

#define RAPIDINPUT_PUBLIC_TYPES_H

#include “memory”

#include “string”

#include “vector”

namespace dacuda

{

    //! @brief Definition of all the public types used by the RapidInput interface

//! @brief Definition of all the public types used by the RapidInput interface

Definition Enum Types

enum EOpenGLState

{

EOpenGLState_Idle = 1,

EOpenGLState_Initialized = 2,

};

//! This enumerations reflect the main states of the recognition engine. These states are

//! tied together through 2 state machines.

//! An OpenGL state machine with 2 states:

//! – “Gl_Idle” Here, initGlSurface() will do transition to “Gl_Initialized”

//! – “Gl_Initialized”

enum EEngineState

{

  EEngineState_Shutdown = 1,

  EEngineState_Initialized = 2,

  EEngineState_CameraStopped = 3,

  EEngineState_CameraRunning = 4,

  EEngineState_RecognitionIdle = 5,

  EEngineState_RecognitionRunning = 6,

};

//! A main state machine with 9 states:

 

//! – “Shutdown”. Here, initialize() will do transition to “Initialized”

//! – “Initialized”. When “Initialized”, machine goes directly to “CameraStopped”

//! – “CameraStopped”. Here, startCamera() will do transition to “Connected”

//! – “CameraRunning”. When camera is running, machine goes directly to “RecognitionIdle”

//! – “RecognitionIdle”. Here, startRecognition() will do transition to “RecognitionRunning”

//! – “RecognitionRunning”. In this state the recognition takes place.

Definition of Messages

enum EError

{

EError_None = 1,

EError_Unknown = 1,

EError_Unexpected_Engine_Stop = 2,

EError_ImageAnalyzer = 3,

EEror_CameraElement = 4,

EError_TextReader = 5,

EError_getVINInfo = 6,

EError_LoadAbbyy = 7,

EError_AbbyyThread = 8,

EError_UnloadAbbyy = 9,

EError_CameraAccessForbidden = 10,

};

//! This enumerations reflect the main states of the recognition engine. These states are

//! tied together through 2 state machines.

//! An OpenGL state machine with 2 states:

//! – “Gl_Idle” Here, initGlSurface() will do transition to “Gl_Initialized”

//! – “Gl_Initialized”

enum ENotif

{

  ENotif_None = 1,

  ENotif_Images_Stream_Timeout = 101,

  ENotif_Ocr_Aborted = 201,

};

enum EError

{

//! Hardware related

//! Engine

//! OCR Related

Definition of Return Images

struct Rect

{

  int x;

  int y;

  unsigned int width;

  unsigned int height;

  Rect()

: x(0), y(0), width(0), height(0)

  { }

  Rect(int _x, int _y, unsigned int _width, unsigned int _height)

: x(_x), y(_y), width(_width), height(_height)

  { }

  Rect(const Rect& from)

: x(from.x), y(from.y), width(from.width), height(from.height)

  { }

};

//! @brief Rectangle Sturcture

class Image

{

public:

  Image(){}

  Image(

std::shared_ptr<unsigned char> image

, unsigned width

, unsigned height

, unsigned dpi

)

  : m_imgRGBA(image)

  , m_width(width)

  , m_height(height)

  , m_dpi(dpi)

  {

  }

  ~Image() {}

  //! @brief The Image class defines the image data format

const std::shared_ptr<unsigned char> data() const { return m_imgRGBA;}

unsigned dataSize() const { return !m_imgRGBA ? 0 : 4 * m_width * m_height; }

unsigned width() const { return m_width; }

unsigned height() const { return m_height; }

unsigned dpi() const { return m_dpi; }

private:

  std::shared_ptr<unsigned char> m_imgRGBA;

unsigned m_width;

unsigned m_height;

unsigned m_dpi;

};

//! @brief Image as row-wise bytes array of RGBA values (4 bytes per pixel)

//! @brief Image size in bytes

//! @brief Image width

//! @brief Image height

//! @brief Image resolution in dpi

 

//! @brief Pointer to the image data

//! @brief Width of the image

//! @brief Height of the image

//! @brief Resolution of the image in dpi

enum EContentField

{

EContentField_MRZ_Type = 40,

EContentField_MRZ_Subtype = 41,

EContentField_MRZ_IssuingState = 42,

EContentField_MRZ_Lastname = 43,

EContentField_MRZ_Firstnames = 44,

EContentField_MRZ_NameTruncationIndicator = 45,

EContentField_MRZ_DocumentNumber = 46,

EContentField_MRZ_DocumentNumberCheckDigit = 47,

EContentField_MRZ_Nationality = 48,

EContentField_MRZ_DateOfBirth = 49,

EContentField_MRZ_DateOfBirthCheckDigit = 50,

EContentField_MRZ_Gender = 51,

EContentField_MRZ_ExpiryDate = 52,

EContentField_MRZ_ExpiryDateCheckDigit = 53,

EContentField_MRZ_OptionalData = 54,

EContentField_MRZ_OptionalData2 = 55,

EContentField_MRZ_OverallCheckDigit = 56,

EContentField_MRZ_Td2CheckDigit = 57,

EContentField_MRZ_Td1CheckDigit = 58,

EContentField_MRZ_DATA = 59,

EContentField_BARCODE_DATA = 70,

EContentField_VIN_DATA = 100

};

/**

* \brief The EContentField enum contains key values for different data fields extracted from the input

*  DO NOT CHANGE THE NUMBERS IN THIS ENUM

*/

typedef struct _ExtractData

{

EContentField key;

char* value;

} ExtractData;

/**

* \brief The ExtractData struct type contains extracted data field types

* and extracted data value.

*/

Definition of callback classes

class CallbackListenerRapidInput {

public:

virtual ~CallbackListenerRapidInput() {}

//! The receiver is notified that an error occurred in the engine

virtual void errorNotification(EError error) = 0;

//! The receiver is notified that an event happened

virtual void eventNotification(ENotif notification) = 0;

//! The receiver is notified on the current state change

virtual void engineStateChanged(EEngineState state) = 0;

//! The receiver is notified that the recognition is successful

virtual void recognitionCompleted(ExtractData* data, uint32_t length, char* outputXml, Image imageZoomedIn, Image imageZoomedOut) = 0;

//! For debugging purposes the receiver is notified that a partcompletedvsdvsdvdsfdfdsf.

virtual void partialRecognition(char* partialRecognition) = 0;

//! The receiver is notified that a snapshot was captured after call

virtual void snapshotCaptured(Image snapshot) = 0;

};

//! @brief Class meant to be inherited from, that sends callbacks to the app

pub

 

lic:

//! The receiver is notified that an error occurred in the engine

//! @param error Defines the error type

//! The receiver is notified that an event happened

//! @param notification Defines the notification type

//! The receiver is notified on the current state change

//! @param state Defines the state of the engine

//! The receiver is notified that the recognition is successful

//! @param result Contains the recognition results and the corresponding images.

 

//! For debugging purposes the receiver is notified that a partial recognition was completed.

//! E.g. ***Z1***645421790

//! The receiver is notified that a snapshot was captured after calling captureSnapshot().

//! @param snapshot contains the captured image.

class CallbackListenerOpenGL {

public:

virtual ~CallbackListenerOpenGL() {}

//! The receiver is notified on the current state change

virtual void openGlStateChanged(EOpenGlState state) = 0;

//! and the app should draw the view. This function will only be called if

//! ConfigRendering.autoDrawing is set to false.

virtual void requestDraw() = 0;

};

//! @brief Class meant to be inherited from, that sends callbacks to the app

class CallbackListenerOpenGL {

public:

 

//! The receiver is notified on the current state change

//! @param state Defines the state of OpenGL

virtual void openGlStateChanged(EOpenGlState state) = 0;

//! @brief This function is called by the engine whenever there is an update

//! and the app should draw the view. This function will only be called if

//! ConfigRendering.autoDrawing is set to false.

Definition of config structs

struct ConfigDebug

{

ConfigDebug() :

partialRecognition(false),

logLevel(1) {}

bool partialRecognition;

int logLevel;

};

//! @brief Configuration for debugging

struct ConfigEngine

{

ConfigEngine ()

listener(nullptr) {}

CallbackListenerRapidInput *listener;

ConfigDebug configDebug;

};

//! @brief Configuration for the engine. These configurations are relevant

//! throughout the complete runtime of the engine.

struct ConfigRecognition

{

ConfigRecognition() :

inputXmlFilePath(nullptr),

targetZone(Rect()),

zoomFactor(1.5f) {}

char* inputXmlFilePath;

float zoomFactor;

Rect targetZone;

};

//! @brief Configuration for the recognition. These configurations are relevant

//! throughout one recognition

struct ConfigOpenGL

{

ConfigOpenGL() :

width(16),

height(9),

listener(nullptr) {}

  int width;

  int height;

  CallbackListenerOpenGL *listener;

};

//! @brief Configuration for OpenGL: Draw callback + container dimensions

struct ConfigRendering

{

ConfigRendering() :

autoRendering(true) {}

bool autoRendering;

ConfigOpenGL configGL;

};

//! @brief Configuration for rendering: OpenGL config + other app parameters

struct ConfigCamera

{

ConfigCamera() :

torchEnabled(false) {}

bool torchEnabled;

};

//! @brief Configuration for camera

//! @param torchEnabled Starts the camera with enabled torch light.

    };

}// namespace dacuda

#endif // RAPIDINPUT_PUBLIC_TYPES_H