setCameraLensSmudgeDetectionEnabled(_:detectionInterval:)
Specify whether to enable camera lens smudge detection, and the interval time between each run of detections.
Declaration
func setCameraLensSmudgeDetectionEnabled(_ cameraLensSmudgeDetectionEnabled: Bool, detectionInterval: CMTime)Parameters
- cameraLensSmudgeDetectionEnabled:
Specify whether camera lens smudge detection should be enabled.
- detectionInterval:
The detection running interval if detection is enabled.
Discussion
Each run of detection processes frames over a short period, and produces one detection result. Use detectionInterval to specify the interval time between each run of detections. For example, when isCameraLensSmudgeDetectionEnabled is set to true and detectionInterval is set to 1 minute, detection runs once per minute, and updates AVCaptureCameraLensSmudgeDetectionStatus. If detectionInterval is set to kCMTimeInvalid, detection runs only once after the session starts. If detectionInterval is set to kCMTimeZero, detection runs continuously.
AVCaptureDevice throws an NSInvalidArgumentException if the isCameraLensSmudgeDetectionSupported property on the current active format returns false. Enabling detection requires a lengthy reconfiguration of the capture render pipeline, so you should enable detection before calling startRunning() or within beginConfiguration() and commitConfiguration() while running.