我对 Android 和 Java 很陌生,但我想稍微修改一下这个示例。
https://github.com/abbyysdk/RTR-SDK.Android/tree/master/sample-textcapture
我想使用/存储 OCR 识别为变量或字符串的内容。
我认为这是我想要获取的信息的行类,并且在这部分代码中。
public void onFrameProcessed( ITextCaptureService.TextLine[] lines,
ITextCaptureService.ResultStabilityStatus resultStatus, ITextCaptureService.Warning warning )
{
// Frame has been processed. Here we process recognition results. In this sample we
// stop when we get stable result. This callback may continue being called for some time
// even after the service has been stopped while the calls queued to this thread (UI thread)
// are being processed. Just ignore these calls:
if( !stableResultHasBeenReached ) {
if( resultStatus.ordinal() >= 3 ) {
// The result is stable enough to show something to the user
surfaceViewWithOverlay.setLines( lines, resultStatus );
} else {
// The result is not stable. Show nothing
surfaceViewWithOverlay.setLines( null, ITextCaptureService.ResultStabilityStatus.NotReady );
}
// Show the warning from the service if any. The warnings are intended for the user
// to take some action (zooming in, checking recognition language, etc.)
warningTextView.setText( warning != null ? warning.name() : "" );
if( resultStatus == ITextCaptureService.ResultStabilityStatus.Stable ) {
// Stable result has been reached. Stop the service
stopRecognition();
stableResultHasBeenReached = true;
// Show result to the user. In this sample we whiten screen background and play
// the same sound that is used for pressing buttons
surfaceViewWithOverlay.setFillBackground( true );
startButton.playSoundEffect( android.view.SoundEffectConstants.CLICK );
}
}
}
太感谢了!