这是我更改的代码,以使条形码跟踪器始终保持在条形码上,但在移动相机时仍会抖动。希望即使在移动相机时,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);
}
}