无需摇晃即可绘制Google Vision api条形码图形跟踪器

时间:2019-02-22 05:53:56

标签: google-vision

这是我更改的代码,以使条形码跟踪器始终保持在条形码上,但在移动相机时仍会抖动。希望即使在移动相机时,Google镜头也能使用更平滑的覆盖效果更好。 我想知道如何使覆盖层保持恒定。

@Override
public void onUpdate(Detector.Detections<Barcode> detectionResults, Barcode 
item) {
    mOverlay.add(mGraphic);
    mGraphic.updateItem(item);
}

/**
 * Hide the graphic when the corresponding object was not detected.  This can happen for
 * intermediate frames temporarily, for example if the object was momentarily blocked from
 * view.
 */
@Override
public void onMissing(Detector.Detections<Barcode> detectionResults) {

    /*if(mOverlay!=null){
        mOverlay.remove(mGraphic);
    }*/
}

/**
 * Called when the item is assumed to be gone for good. Remove the graphic annotation from
 * the overlay.
 */
@Override
public void onDone() {
    if(mOverlay!=null){
        mOverlay.remove(mGraphic);
    }

}

0 个答案:

没有答案