<!--
{
  "availability" : [
    "iOS: 5.0.0 -",
    "iPadOS: 5.0.0 -",
    "macCatalyst: 13.1.0 -",
    "macOS: 10.7.0 -",
    "tvOS: -",
    "visionOS: 1.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CoreImage",
  "identifier" : "/documentation/CoreImage/CIDetector/init(ofType:context:options:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "Core Image"
    ],
    "preciseIdentifier" : "c:objc(cs)CIDetector(cm)detectorOfType:context:options:"
  },
  "title" : "init(ofType:context:options:)"
}
-->

# init(ofType:context:options:)

Creates and returns a configured detector.

```
init?(ofType type: String, context: CIContext?, options: [String : Any]? = nil)
```

## Parameters

`type`

A string indicating the kind of detector you are interested in. See [Detector Types](/documentation/CoreImage/detector-types).

`context`

A Core Image context that the detector can use when analyzing an image.

`options`

A dictionary containing details on how you want the detector to be configured. See [Detector Configuration Keys](/documentation/CoreImage/detector-configuration-keys).

## Return Value

A configured detector.

## Discussion

A [`CIDetector`](/documentation/CoreImage/CIDetector) object can potentially create and hold a significant amount of resources. Where possible, reuse the same [`CIDetector`](/documentation/CoreImage/CIDetector) instance. Also, when processing images with a detector object, your application performs better if the [`CIContext`](/documentation/CoreImage/CIContext) used to initialize the detector is the same context used to process the <doc://com.apple.documentation/documentation/UIKit/UIImage/ciImage> objects.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)