Android Custom Data Field

  • 51 Views
  • Last Post 1 weeks ago
Zloj08 posted this 10 October 2017

Hi. 

Good Morning, Im having slight confusion when trying to create a custom data field for read digits chars. I've read the developers handbook and I still have been able to figure it out. http://rtrsdk.com/documentation/how-to/android-custom-data-capture. Please in your answer provide an example. 

Please show; 

1.Whats wrong with my code?

2. What wrong with my RegEx?

3. How I can control threads in process scanning my text?

 

Thank you!

 

    private boolean createTextCaptureService() {
try {
engine = Engine.load(ScannerActivity.this, licenseFileName);
dataCaptureServic = engine.createDataCaptureService(null, new IDataCaptureService.Callback() {
@Override
public void onFrameProcessed(
IDataCaptureService.DataScheme mDataScheme,
IDataCaptureService.DataField[] lines,
IRecognitionService.ResultStabilityStatus resultStatus,
IRecognitionService.Warning warning) {

if (mDataScheme == null) {
surfaceViewWithOverlay.setLines(null, ITextCaptureService.ResultStabilityStatus.NotReady);
return;
}
if (!stableResultHasBeenReached) {
if (resultStatus.ordinal() >= 3 && lines != null && lines.length > 0) {
surfaceViewWithOverlay.setLines(lines, resultStatus);
} else {
surfaceViewWithOverlay.setLines(null, ITextCaptureService.ResultStabilityStatus.NotReady);
}
if (resultStatus == ITextCaptureService.ResultStabilityStatus.Stable) {
isMakeInitScanner = true;
onStartButtonClick(true);
stableResultHasBeenReached = true;
surfaceViewWithOverlay.setFillBackground(true);
startButton.playSoundEffect(android.view.SoundEffectConstants.CLICK);
}
}
}

@Override
public void onRequestLatestFrame(byte[] data) {
camera.addCallbackBuffer(data);
}

@Override
public void onError(Exception e) {
}
});
IDataCaptureProfileBuilder profileBuilder = dataCaptureServic.configureDataCaptureProfile();
profileBuilder.setRecognitionLanguage(Language.English);
profileBuilder
.addScheme(SCHEME)
.setName("Profile")
.addField("sampleField")
.setRegEx("([0-9+>]*\\)*\\(*\\s*)+");
profileBuilder.checkAndApply();

return true;
} catch (java.io.IOException e) {
} catch (Engine.LicenseException e) {
} catch (Throwable e) {
}
return false;
}

Diana Khammatova posted this 1 weeks ago

Hi!

Could you please send us additional information in order to investigate your issues deeper?

1. What version of RTR SDK do you use: free or extended? If the second one, then kindly specify your serial number and the build number of RTR SDK. (You can find the build number of RTR SDK in the Readme.html file included in the distribution.)

2. Please describe your issues in more details. (You can attach some screenshots and logs for illustrating the problem.)

a) What error messages do you get?

b) What text strings do you want to recognize? Please send us the set of frames, illustrating the issue.

c) What do you get as a result of recognition?

3. Could you please specify if is it possible to reproduce the issue using standard sample? If this is the case, please send us
your project based on a modified standard sample. If it is not possible to reproduce the issue using our standard sample please send us a minimal project that reproduces your issue and the stepwise instruction of how to launch such project and reproduce the issue.

You can send this information to SDK_Support@abbyy.com

As for the third issue, in case of "Capture text from Camera" scenario after a call of the start method of the ITextCaptureService interface several theads will start working. If you would like to pause or stop the application, you can call the ITextCaptureService.stop method to terminate the processing threads. The same methods are used in the "Capture a Custom Data Field" scenario.

Close