Search in sources :

Example 11 with TextBlock

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);
        }
    }
}
Also used : TextBlock(com.google.android.gms.vision.text.TextBlock)

Example 12 with TextBlock

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);
    }
}
Also used : TextBlock(com.google.android.gms.vision.text.TextBlock)

Aggregations

TextBlock (com.google.android.gms.vision.text.TextBlock)12 RectF (android.graphics.RectF)4 Text (com.google.android.gms.vision.text.Text)3 Intent (android.content.Intent)2 WritableArray (com.facebook.react.bridge.WritableArray)2 WritableMap (com.facebook.react.bridge.WritableMap)2 Line (com.google.android.gms.vision.text.Line)1 ImageDimensions (org.reactnative.camera.utils.ImageDimensions)1