Detection

public abstract class Detection

Represents one detected object in the results of ERROR(/com.google.mediapipe.tasks.version.objectdetector.ObjectDetector).

Public Constructors

Public Methods

abstract RectF
boundingBox()
A ERROR(/RectF) object to represent the bounding box of the detected object.
abstract List<Category>
categories()
A list of Category objects.
static Detection
create(List<Category> categories, RectF boundingBox, Optional<List<NormalizedKeypoint>> keypoints)
Creates a Detection instance from a list of Category and a bounding box.
static Detection
create(List<Category> categories, RectF boundingBox)
Creates a Detection instance from a list of Category and a bounding box.
static Detection
createFromProto(com.google.mediapipe.formats.proto.DetectionProto.Detection detectionProto)
abstract Optional<List<NormalizedKeypoint>>
keypoints()
An optional list of NormalizedKeypoint associated with the detection.

Inherited Methods

Public Constructors

public Detection ()

Public Methods

public abstract RectF boundingBox ()

A ERROR(/RectF) object to represent the bounding box of the detected object.

public abstract List<Category> categories ()

A list of Category objects.

public static Detection create (List<Category> categories, RectF boundingBox, Optional<List<NormalizedKeypoint>> keypoints)

Creates a Detection instance from a list of Category and a bounding box.

Parameters
categories a list of Category objects that contain category name, display name, score, and the label index.
boundingBox a ERROR(/RectF) object to represent the bounding box.
keypoints an optional list of ERROR(/NormalizedKeypoints) associated with the detection.

public static Detection create (List<Category> categories, RectF boundingBox)

Creates a Detection instance from a list of Category and a bounding box.

Parameters
categories a list of Category objects that contain category name, display name, score, and the label index.
boundingBox a ERROR(/RectF) object to represent the bounding box.

public static Detection createFromProto (com.google.mediapipe.formats.proto.DetectionProto.Detection detectionProto)

public abstract Optional<List<NormalizedKeypoint>> keypoints ()

An optional list of NormalizedKeypoint associated with the detection. Keypoints represent interesting points related to the detection. For example, the keypoints represent the eyes, ear and mouth from face detection model. Or in the template matching detection, e.g. KNIFT, they can represent the feature points for template matching.