當前位置: 首頁>>代碼示例>>Java>>正文


Java Detector.Detections方法代碼示例

本文整理匯總了Java中com.google.android.gms.vision.Detector.Detections方法的典型用法代碼示例。如果您正苦於以下問題:Java Detector.Detections方法的具體用法?Java Detector.Detections怎麽用?Java Detector.Detections使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.google.android.gms.vision.Detector的用法示例。


在下文中一共展示了Detector.Detections方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * 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);
        if (item != null && item.getValue() != null) {
            final String wort = item.getValue();
            if(wort.length() > 1 && Character.isUpperCase(wort.charAt(0)) && wort.matches("[A-Za-z-]+") && wort.charAt(wort.length() - 1) != '-') {
                Log.d("OCR", "Name detected: " + wort);
                // Show AccountDetailActivity
                new Thread(new Runnable() {
                    @Override
                    public void run() {
                        DownloadIntentService.startService(context, OcrCaptureActivity.DOWNLOAD_REQUEST_CODE, wort);
                    }
                }).start();
            } else {
                Log.d("OcrDetectorProcessor", "Text detected! " + item.getValue());
            }
        }
    }
}
 
開發者ID:Jugendhackt,項目名稱:SocialPaka,代碼行數:31,代碼來源:OcrDetectorProcessor.java

示例2: filterInvalidDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
private List<Text> filterInvalidDetections(Detector.Detections<TextBlock> items) {
    List<Text> result = new ArrayList<>();
    SparseArray<TextBlock> detectedItems = items.getDetectedItems();

    for (int i = 0; i < detectedItems.size(); ++i) {
        TextBlock textBlock = detectedItems.valueAt(i);

        // Get sub-components and extract only lines
        List<? extends Text> components = textBlock.getComponents();

        for (Text component : components) {
            String value = component.getValue();
            if (component instanceof Line
                    && value != null
                    && !value.isEmpty()
                    && isFoodRelated((value))) {
                result.add(component);
            } else {
                Log.d(TAG, "filterInvalidDetections: sub-component is not a Line, should we go deeper?");
            }
        }
    }
    return result;
}
 
開發者ID:dvdciri,項目名稱:DeepImagePreview-Project,代碼行數:25,代碼來源:OcrDetectorProcessor.java

示例3: onUpdate

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * Update the position/characteristics of the item within the overlay.
 */
@Override
public void onUpdate(Detector.Detections<Barcode> detectionResults, Barcode item) {
    mOverlay.add(mGraphic);
    mGraphic.updateItem(item);

    if (detectionResults != null && detectionResults.getDetectedItems().size() > 1) {
        Log.e("XX", "Multiple items detected");
        Log.e("XX", "onUpdate: " + detectionResults.getDetectedItems().size());

        if (listener != null) {
            List<Barcode> barcodes = asList(detectionResults.getDetectedItems());
            listener.onScannedMultiple(barcodes);
        }
    }
}
 
開發者ID:ravi8x,項目名稱:Barcode-Reader,代碼行數:19,代碼來源:BarcodeGraphicTracker.java

示例4: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * 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);
        if (item != null && item.getValue() != null) {
            if (item.getValue().contains("INSTITUTO FEDERAL ELECTORAL")) {
                documentIdentifier.setType(Constants.IFEB);
            } else if (item.getValue().contains("INSTITUTO NACIONAL ELECTORAL")) {
                Log.d("OcrDetectorProcessor", "INE E " + item.getValue());
                documentIdentifier.setType(Constants.IFEE);
            }
        }
        //OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
        //mGraphicOverlay.add(graphic);
    }
}
 
開發者ID:BrandonVargas,項目名稱:AndroidOCRFforID,代碼行數:26,代碼來源:OcrDetectorProcessor.java

示例5: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * Called by the detector to deliver detection results.
 * If your application called for it, this could be a place to icon_save 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();
    //final String result;
    //String detectedText = "";
    SparseArray<TextBlock> items = detections.getDetectedItems();
    for (int i = 0; i < items.size(); ++i) {

        final TextBlock item = items.valueAt(i);
        OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
        mGraphicOverlay.add(graphic);
        //detectedText += item.getValue();
    }

    /*result = detectedText;
    ((OcrCaptureActivity)context).runOnUiThread(new Runnable() {
        @Override
        public void run() {
            Toast.makeText(context, result, Toast.LENGTH_SHORT).show();
        }
    });*/
}
 
開發者ID:volkansahin45,項目名稱:Moneycim,代碼行數:30,代碼來源:OcrDetectorProcessor.java

示例6: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
@Override
public void receiveDetections(final Detector.Detections<Barcode> var1) {
    if (isResume && var1.getDetectedItems().size() > 0) {
        pauseDetector();
        final Barcode barcode = var1.getDetectedItems().valueAt(0);
        handler.post(new Runnable() {
            @Override
            public void run() {
                if(!handleBarcode(barcode)){
                    resumeDetector();
                }
            }
        });

    }
}
 
開發者ID:MobileTribe,項目名稱:pandroid,代碼行數:17,代碼來源:PandroidScannerView.java

示例7: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
@Override
public void receiveDetections(Detector.Detections<TextBlock> detections) {
    SparseArray<TextBlock> items = detections.getDetectedItems();
    for (int i = 0; i < items.size(); ++i) {
        TextBlock item = items.valueAt(i);
        if (item != null && item.getValue() != null) {
            Log.d("Processor", "Text detected! " + item.getValue());
        }
    }
}
 
開發者ID:zackszhu,項目名稱:hack_sjtu_2017,代碼行數:11,代碼來源:OCRActivity.java

示例8: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * 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);
    }
}
 
開發者ID:DevipriyaSarkar,項目名稱:OCR-Reader,代碼行數:18,代碼來源:OcrDetectorProcessor.java

示例9: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * 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();
    final SparseArray<TextBlock> items = detections.getDetectedItems();
    for (int i = 0; i < items.size(); ++i) {
        TextBlock item = items.valueAt(i);
        if (item != null && item.getValue() != null) {
            Log.d("OcrDetectorProcessor", "Text detected! " + item.getValue());
        }
        OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
        mGraphicOverlay.add(graphic);
    }

}
 
開發者ID:OlayinkaPeter,項目名稱:Toodoo,代碼行數:22,代碼來源:OcrDetectorProcessor.java

示例10: onUpdate

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * Update the position/characteristics of the item within the overlay.
 */
@Override
public void onUpdate(Detector.Detections<Barcode> detectionResults, Barcode item) {
    mOverlay.add(mGraphic);
    mGraphic.updateItem(item);
    mActivity.updateResult(item);
}
 
開發者ID:Emrals,項目名稱:Fuse,代碼行數:10,代碼來源:BarcodeGraphicTracker.java

示例11: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
@Override
public void receiveDetections(Detector.Detections<Barcode> detections) {
    final SparseArray<Barcode> barcodes = detections.getDetectedItems();

    if (barcodes.size() != 0) {
        mApiKey = barcodes.valueAt(0).displayValue;
        getActivity().runOnUiThread(this);
    }
}
 
開發者ID:nairbspace,項目名稱:octoandroid,代碼行數:10,代碼來源:QrDialogFragment.java

示例12: onUpdate

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
@Override
public void onUpdate(Detector.Detections<Face> detectionResults, Face face) {
    //Add the face
    if (face != null) {
        mOverlay.add(mFaceGraphic);
        mFaceGraphic.updateFace(face);
    }

    //Check num faces
    int x = detectionResults.getDetectedItems().size();
    updateFaces(x);
}
 
開發者ID:PGMacDesign,項目名稱:PGMacTips,代碼行數:13,代碼來源:FaceTrackerWithGraphic.java

示例13: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * 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);
        if (item != null && item.getValue() != null) {
            Log.d("OcrDetectorProcessor", "Text detected! " + item.getValue());
        }
        OcrGraphic graphic = new OcrGraphic(mGraphicOverlay, item);
        mGraphicOverlay.add(graphic);
    }
}
 
開發者ID:googlesamples,項目名稱:android-vision,代碼行數:21,代碼來源:OcrDetectorProcessor.java

示例14: receiveDetections

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
@Override
public void receiveDetections(Detector.Detections<Barcode> detections) {
    SparseArray<Barcode> barcodes = detections.getDetectedItems();
    if (barcodes.size() > 0) {
        //return first barcode
        Intent data = new Intent();
        data.putExtra(BarcodeObject, barcodes.valueAt(0));
        setResult(CommonStatusCodes.SUCCESS, data);
        finish();
    }
}
 
開發者ID:secondsun,項目名稱:devnexus-android,代碼行數:12,代碼來源:BarcodeCaptureActivity.java

示例15: onUpdate

import com.google.android.gms.vision.Detector; //導入方法依賴的package包/類
/**
 * Update the position/characteristics of the item within the overlay.
 */
@Override
public void onUpdate(Detector.Detections<Barcode> detectionResults, Barcode item) {
    mOverlay.add(mGraphic);
    mGraphic.updateItem(item);
    if (mListener != null) {
        mListener.onCodeScanned(item.rawValue);
    }
}
 
開發者ID:adafruit,項目名稱:Bluefruit_LE_Connect_Android,代碼行數:12,代碼來源:BarcodeGraphicTracker.java


注:本文中的com.google.android.gms.vision.Detector.Detections方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。