DetectionTaskCallback
Stay organized with collections
Save and categorize content based on your preferences.
Interface for defining a post-processing action to be executed for each detection.This is
used by CameraXSource
for the pipeline to feed camera frames to detectors and invoke callbacks that are set by
developers. Developers must override the
onDetectionTaskReceived(Task)
callback in order to receive detection tasks.
Public Methods
public abstract void onDetectionTaskReceived (Task<ResultT> detectionTask)
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-31 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["\u003cp\u003e\u003ccode\u003eDetectionTaskCallback\u003c/code\u003e is an interface used to define actions performed after each detection within the CameraXSource pipeline.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers need to override the \u003ccode\u003eonDetectionTaskReceived\u003c/code\u003e method to get detection tasks from the \u003ccode\u003eCameraXSource\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCameraXSource\u003c/code\u003e uses this interface to feed camera frames to detectors and trigger developer-set callbacks.\u003c/p\u003e\n"]]],["The `DetectionTaskCallback` interface defines post-processing for each detection using `CameraXSource`. Developers must implement `onDetectionTaskReceived(Task)` to receive these tasks. `CameraXSource` uses this callback to feed camera frames to detectors. The `onDetectionTaskReceived` method, the only method in the interface, is called by `CameraXSource` to deliver a detection task to the callback. This enables developers to define actions for each detected item within the camera frame pipeline.\n"],null,["public interface **DetectionTaskCallback** \nInterface for defining a post-processing action to be executed for each detection.This is\nused by [CameraXSource](/android/reference/com/google/mlkit/vision/camera/CameraXSource)\nfor the pipeline to feed camera frames to detectors and invoke callbacks that are set by\ndevelopers. Developers must override the [onDetectionTaskReceived(Task)](/android/reference/com/google/mlkit/vision/camera/DetectionTaskCallback#onDetectionTaskReceived(com.google.android.gms.tasks.Task\u003cResultT\u003e)) callback in order to receive detection tasks. \n\nPublic Method Summary\n\n|---------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract void | [onDetectionTaskReceived](/android/reference/com/google/mlkit/vision/camera/DetectionTaskCallback#onDetectionTaskReceived(com.google.android.gms.tasks.Task\u003cResultT\u003e))(Task\\\u003cResultT\\\u003e detectionTask) Called by the [CameraXSource](/android/reference/com/google/mlkit/vision/camera/CameraXSource) to deliver a detection task to the [DetectionTaskCallback](/android/reference/com/google/mlkit/vision/camera/DetectionTaskCallback). |\n\nPublic Methods \n\npublic abstract void **onDetectionTaskReceived** (Task\\\u003cResultT\\\u003e detectionTask) \nCalled by the [CameraXSource](/android/reference/com/google/mlkit/vision/camera/CameraXSource)\nto deliver a detection task to the [DetectionTaskCallback](/android/reference/com/google/mlkit/vision/camera/DetectionTaskCallback)."]]