---
title: DetectLensSmudgeRequest
framework: vision
role: symbol
role_heading: Structure
path: vision/detectlenssmudgerequest
---

# DetectLensSmudgeRequest

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

## Declaration

```swift
struct DetectLensSmudgeRequest
```

## Overview

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. Perform this request when detecting a smudge within an image or video frame. The request returns a SmudgeObservation. This observation contains a floating-point 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 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 to your chosen capture type. 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(_:)](vision/detectlenssmudgerequest/init(_:).md)

### Performing a request

- [perform(on:orientation:)](vision/imageprocessingrequest/perform(on:orientation:)-80bya.md)
- [perform(on:orientation:)](vision/imageprocessingrequest/perform(on:orientation:)-3f3f1.md)
- [perform(on:orientation:)](vision/imageprocessingrequest/perform(on:orientation:)-qxxx.md)
- [perform(on:orientation:)](vision/imageprocessingrequest/perform(on:orientation:)-xspx.md)
- [perform(on:orientation:)](vision/imageprocessingrequest/perform(on:orientation:)-3hddl.md)
- [perform(on:orientation:)](vision/imageprocessingrequest/perform(on:orientation:)-85ex1.md)

### Understanding the result

- [SmudgeObservation](vision/smudgeobservation.md)

### Configuring a request

- [cropAndScaleAction](vision/detectlenssmudgerequest/cropandscaleaction.md)
- [ImageCropAndScaleAction](vision/imagecropandscaleaction.md)

### Getting the revision

- [revision](vision/detectlenssmudgerequest/revision-swift.property.md)
- [supportedRevisions](vision/detectlenssmudgerequest/supportedrevisions.md)
- [DetectLensSmudgeRequest.Revision](vision/detectlenssmudgerequest/revision-swift.enum.md)

## Relationships

### Conforms To

- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [ImageProcessingRequest](vision/imageprocessingrequest.md)
- [Sendable](swift/sendable.md)
- [SendableMetatype](swift/sendablemetatype.md)
- [VisionRequest](vision/visionrequest.md)

## See Also

### Image quality and saliency analysis

- [Implementing saliency-based image cropping in iOS and watchOS](vision/implementing-saliency-based-image-cropping-in-ios-and-watchos.md)
- [Generating high-quality thumbnails from videos](vision/generating-thumbnails-from-videos.md)
- [CalculateImageAestheticsScoresRequest](vision/calculateimageaestheticsscoresrequest.md)
- [GenerateAttentionBasedSaliencyImageRequest](vision/generateattentionbasedsaliencyimagerequest.md)
- [GenerateObjectnessBasedSaliencyImageRequest](vision/generateobjectnessbasedsaliencyimagerequest.md)
