Appery Text Recognition

Text recognition

TextRecognizer.recognizeText

Parameters
  • {string} filePath - path to image
  • {function} success - callback function which takes a parameter data which will be invoked on success
  • {function} error - callback function which takes a parameter err which will be invoked on failure
Supported Options
propertyvaluedescription
useBase64false (default) / trueWhether or not filePath is a base64 encoded string.

Example:

window.ApperyioMLCordovaPlugin.TextRecognizer.recognizeText('filePath', successCallback, errorCallback)

Sample JSON callback: text_recognition.json

Realtime text recognition from camera

TextRecognizer.startRealTimeRecognition

Parameters
  • {function} success - callback function which takes a parameter data which will be invoked on success
  • {function} error - callback function which takes a parameter err which will be invoked on failure
  • {object} options - options for face detector
Supported Options
propertyvaluedescription
showDetectedTexttrue (default) / falseWhether or not show detected text on video overlay
frameImageDatatrue (default) / falseWhether include base64 of captured text photo or not
frameImageResultTypeCameraResultType.BASE64_STRING (default) / CameraResultType.DATA_URLinclude captured photo as only base64 string or as full data url
delay500 (default)Time interval in msec, for performing recognition each interval value
encodingTypeEncodingType.JPEG (default) / EncodingType.PNGformat of output image
cameraDirectionCameraDirection.BACK (default) / CameraDirection.FRONTUse back or front camera of device during text recognition
detectedTextImageDatatrue (default) / falsereturn or not cropped text image data in base64 format depends on frameImageResultType option value for every detected text block; if true, each item of response "textBlocks" array contains "textBlockImage" field with the data

Example:

window.ApperyioMLCordovaPlugin.TextRecognizer.startRealTimeRecognition(successCallback, errorCallback, {
   showDetectedText: true,
   frameImageData: true,
   frameImageResultType: ApperyioMLCordovaPlugin.TextRecognizer.TextDetectorOptions.CameraResultType.DATA_URL,
   encodingType: ApperyioMLCordovaPlugin.TextRecognizer.TextDetectorOptions.EncodingType.PNG,
   cameraDirection: ApperyioMLCordovaPlugin.TextRecognizer.TextDetectorOptions.CameraDirection.FRONT
   delay: 100,
   detectedTextImageData: true
})

Sample JSON callback: text_recognition_realtime.json

TextRecognizer.stopRealTimeRecognition

Parameters
  • {function} success - callback function which takes a parameter data which will be invoked on success
  • {function} error - callback function which takes a parameter err which will be invoked on failure

Example:

window.ApperyioMLCordovaPlugin.TextRecognizer.stopRealTimeRecognition(successCallback, errorCallback)