use of com.google.android.gms.vision.text.TextBlock in project CameraKit-Android by flurgle.
the class TextProcessor method receiveDetections.
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
SparseArray<TextBlock> detectedItems = detections.getDetectedItems();
for (int i = 0; i < detectedItems.size(); ++i) {
TextBlock item = detectedItems.valueAt(i);
if (item != null && item.getValue() != null) {
CameraKitTextDetect event = new CameraKitTextDetect(new CameraKitTextBlock(item));
mEventDispatcher.dispatch(event);
callback.callback(event);
}
}
}
use of com.google.android.gms.vision.text.TextBlock in project android-vision by googlesamples.
the class OcrDetectorProcessor method receiveDetections.
/**
* Called by the detector to deliver detection results.
* If your application called for it, this could be a place to check for
* equivalent detections by tracking TextBlocks that are similar in location and content from
* previous frames, or reduce noise by eliminating TextBlocks that have not persisted through
* multiple detections.
*/
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
mGraphicOverlay.clear();
SparseArray<TextBlock> items = detections.getDetectedItems();
for (int i = 0; i < items.size(); ++i) {
TextBlock item = items.valueAt(i);
OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
mGraphicOverlay.add(graphic);
}
}
Aggregations