<!--
{
  "availability" : [
    "iOS: 26.0.0 -",
    "iPadOS: 26.0.0 -",
    "macOS: 26.0.0 -",
    "tvOS: 26.0.0 -",
    "visionOS: 26.0.0 -",
    "watchOS: 27.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Vision",
  "identifier" : "/documentation/Vision/DetectLensSmudgeRequest",
  "metadataVersion" : "0.1.0",
  "role" : "Structure",
  "symbol" : {
    "kind" : "Structure",
    "modules" : [
      "Vision"
    ],
    "preciseIdentifier" : "s:6Vision23DetectLensSmudgeRequestV"
  },
  "title" : "DetectLensSmudgeRequest"
}
-->

# DetectLensSmudgeRequest

A request that detects a smudge on a lens from an image or video frame capture.

```
struct DetectLensSmudgeRequest
```

## Overview

Use this request to detect whether an image or video is captured with a smudged lens. A smudge is anything that obscures a lens, like a fingerprint or raindrops, resulting in a hazy or blurry capture. Use this capability to find the best frame from a video or set of images.



![A clear image of poppies in a field.](images/Vision/detect-lens-smudge-overview-clear@2x.png)



![A hazy image of poppies in a field.](images/Vision/detect-lens-smudge-overview-obscured@2x.png)

Perform this request when detecting a smudge within an image or video frame. The request returns a [`SmudgeObservation`](/documentation/Vision/SmudgeObservation). This observation contains a floating-point [`confidence`](/documentation/Vision/SmudgeObservation/confidence) value in the range of  `0.0` to `1.0` indicating the probability that a capture has an impaired or smudged lens at capture time. A score of `1.0` represents a high probability the lens is smudged at capture time.

Running [`DetectLensSmudgeRequest`](/documentation/Vision/DetectLensSmudgeRequest) requires a device with A14 Bionic and later or device with M1 and later.

> Note: Certain types of content may be categorized as a smudge, such as naturally-blurred objects, long exposure, and motion blur while taking a photo. Make sure that you are using a request on a fixed capture where the device is stable when taking the image.

To use the properties of the request, add a [`ImageProcessingRequest`](/documentation/Vision/ImageProcessingRequest) to your chosen capture type.

```swift
func isGoodCapture(imageURL:URL) async throws -> Bool {
   
   // Set an optional threshold from 0.0 to 1.0 to flag a maximum level of smudge in your capture.
    let smudgeThreshold: Float = 0.9;
    let request = DetectLensSmudgeRequest(.revision1)
    let smudgeObservation = try await request.perform(on: imageURL)
    
    return (smudgeObservation.confidence < smudgeThreshold)
}
```

## Topics

### Creating a request

[`init(_:)`](/documentation/Vision/DetectLensSmudgeRequest/init(_:))

Creates a request to detect whether the camera lens has a smudge.

### Performing a request

[`perform(on:orientation:)`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-80bya)

Performs the request on an image URL and produces observations.

[`perform(on:orientation:)`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-3f3f1)

Performs the request on image data and produces observations.

[`perform(on:orientation:)`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-qxxx)

Performs the request on a Core Graphics image and produces observations.

[`perform(on:orientation:)`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-xspx)

Performs the request on a pixel buffer and produces observations.

[`perform(on:orientation:)`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-3hddl)

Performs the request on a Core Media buffer and produces observations.

[`perform(on:orientation:)`](/documentation/Vision/ImageProcessingRequest/perform(on:orientation:)-85ex1)

Performs the request on a Core Image image and produces observations.

### Understanding the result

[`SmudgeObservation`](/documentation/Vision/SmudgeObservation)

An observation that provides an overall score of the presence of a smudge in an image or video frame capture.

### Configuring a request

[`cropAndScaleAction`](/documentation/Vision/DetectLensSmudgeRequest/cropAndScaleAction)

An optional setting that tells the algorithm how to scale an input image before generating the result.

[`ImageCropAndScaleAction`](/documentation/Vision/ImageCropAndScaleAction)

A scale to apply to an input image before performing a request.

### Getting the revision

[`revision`](/documentation/Vision/DetectLensSmudgeRequest/revision-swift.property)

The algorithm or implementation the request uses.

[`supportedRevisions`](/documentation/Vision/DetectLensSmudgeRequest/supportedRevisions)

The collection of revisions the request supports.

[`Revision`](/documentation/Vision/DetectLensSmudgeRequest/Revision-swift.enum)

A type that describes the algorithm or implementation that the request performs.

## Relationships

### Conforms To

[`Hashable`](/documentation/Swift/Hashable)

[`Sendable`](/documentation/Swift/Sendable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`ImageProcessingRequest`](/documentation/Vision/ImageProcessingRequest)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`VisionRequest`](/documentation/Vision/VisionRequest)

[`Equatable`](/documentation/Swift/Equatable)

---

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)