I am using the sample code of mobile vision to perform text detection on an image. Here is the code
private void detectInVisionImage(
FirebaseVisionImage image,
final FrameMetadata metadata,
final GraphicOverlay graphicOverlay) {
detectInImage(image)
.addOnSuccessListener(
new OnSuccessListener<T>() {
@Override
public void onSuccess(T results) {
shouldThrottle.set(false);
VisionProcessorBase.this.onSuccess(results, metadata,
graphicOverlay);
}
})
.addOnFailureListener(
new OnFailureListener() {
@Override
public void onFailure(@NonNull Exception e) {
shouldThrottle.set(false);
VisionProcessorBase.this.onFailure(e);
}
});
// Begin throttling until this frame of input has been processed, either in onSuccess or
// onFailure.
shouldThrottle.set(true);
}
For some reason, the onSuccessListener is being called so many times ( as if it is continuous detection). Although I call the detectInVisionImage only once on an image.
Why is this happening? A bug?
Thank you