Any way to trigger cameraLensSmudgeDetectionStatus to change?

Looking to implement to UI to tell the user to clean their lens in our app.

Implemented the KVO for the cameraLensSmudgeDetectionStatus but I'm having issues reliably triggering it in, both in our app and the main camera app. Tried to get inventive by putting tupperware over the lens, but I think the model driving this or the LiDAR sensor might be smart enough to detect there is something close to the lens.

Is there any way to trigger this change in a similar way we can trigger thermal changes in debug?

Thanks.

Answered by Media Engineer in 873584022

Hi. The detection algorithm used for finding smudges is power intensive, so by default it only runs when the capture session starts. If you want it to check periodically for smudges, you need to set an appropriate detection interval when calling - (void)setCameraLensSmudgeDetectionEnabled:(BOOL)cameraLensSmudgeDetectionEnabled detectionInterval:(CMTime)detectionInterval

Are you already doing that?

Thanks for your post and very interesting. Please be aware I'm not an expert on that API and I invite other experts to this thread.

It looks like you are trying to use the API for something else that is intended to. The camera lens smudge detection is designed to automatically activate when the system detects potential obstructions but for smudges on the lens, and you are trying to use it for the obstruction only for the lidar sensor?

https://developer.apple.com/documentation/avfoundation/avcapturedevice/cameralenssmudgedetectionstatus

As you’ve noticed, the system's smart algorithms, potentially incorporating input from multiple sensors, including LiDAR, can make it difficult to simulate lens obstruction reliably using simple physical methods like covering the lens.

Unfortunately, due to hardware-level optimizations and privacy considerations, Apple does not expose further control over this feature to third-party developers looks like.

However if you would like an enhancement to fulfill your requirements I would recommend to submit a enhancement request:

If you'd like us to consider adding the necessary functionality, please file an enhancement request using Feedback Assistant. Once you file the request, please post the FB number here.

If you're not familiar with how to file enhancement requests, take a look at Bug Reporting: How and Why?

Albert Pascual
  Worldwide Developer Relations.

Hi. The detection algorithm used for finding smudges is power intensive, so by default it only runs when the capture session starts. If you want it to check periodically for smudges, you need to set an appropriate detection interval when calling - (void)setCameraLensSmudgeDetectionEnabled:(BOOL)cameraLensSmudgeDetectionEnabled detectionInterval:(CMTime)detectionInterval

Are you already doing that?

Any way to trigger cameraLensSmudgeDetectionStatus to change?
 
 
Q