# Detection

    class Detection: NSObject

Represents one detected object in the results of `ObjectDetector`.
- `
  ### [init(categories:boundingBox:keypoints:)](https://developers.google.com/edge/api/mediapipe/swift/vision/Classes/Detection.md.txt#/c:objc(cs)MPPDetection(im)initWithCategories:boundingBox:keypoints:)

  ` Initializes a new `Detection` object with the given array of categories, bounding box and optional array of keypoints;

  #### Declaration

  Swift

      init(categories: [ResultCategory], boundingBox: CGRect, keypoints: [NormalizedKeypoint]?)

  #### Parameters

  |---|---|
  | `categories` | A list of `Category` objects that contain category name, display name, score, and the label index. |
  | `boundingBox` | A `CGRect` that represents the bounding box. @param keypoints: An optional array of `NormalizedKeypoint` objects associated with the detection. Keypoints represent interesting points related to the detection. For example, the keypoints represent the eyes, ear and mouth from the face detection model. In template matching detection, e.g. KNIFT, they can instead represent the feature points for template matching. |

  #### Return Value

  An instance of `Detection` initialized with the given array of categories, bounding box and `nil` keypoints.
- `
  ### [boundingBox](https://developers.google.com/edge/api/mediapipe/swift/vision/Classes/Detection.md.txt#/c:objc(cs)MPPDetection(py)boundingBox)

  ` The bounding box of the detected object.

  #### Declaration

  Swift

      var boundingBox: CGRect { get }

- `
  ### [categories](https://developers.google.com/edge/api/mediapipe/swift/vision/Classes/Detection.md.txt#/c:objc(cs)MPPDetection(py)categories)

  ` An array of `Category` objects containing the predicted categories.

  #### Declaration

  Swift

      var categories: [ResultCategory] { get }

- `
  ### [keypoints](https://developers.google.com/edge/api/mediapipe/swift/vision/Classes/Detection.md.txt#/c:objc(cs)MPPDetection(py)keypoints)

  ` An optional array of `NormalizedKeypoint` objects associated with the detection. Keypoints represent interesting points related to the detection. For example, the keypoints represent the eyes, ear and mouth from the from detection model. In template matching detection, e.g. KNIFT, they can instead represent the feature points for template matching.

  #### Declaration

  Swift

      var keypoints: [NormalizedKeypoint]? { get }