A camera's auto-focus algorithm is a bit of black box magic where I have a passing interest. I was disappointed to learn while Adafruit's Memento camera module exposes programmable control over its focus mechanism, the auto-focus algorithm remains opaque hiding inside its own black box. A brief survey of custom Canon camera firmware found that they're not likely to have any details, either, as they call into existing Canon code to handle that kind of thing. A bit of web search found that I could dig up research papers on the topic, but I don't foresee how this interest could grow beyond idle curiosity.

With commercial offerings at a dead end, I started looking at the venerable OpenCV library and how it might enable research and experimentation in auto-focus algorithms. It turns out Adafruit Memento is not the only camera to expose control over focus mechanism or triggering an auto-focus black box. Some cameras expose similar things in their OpenCV capture driver in the form of capture capabilities. I suppose it would be possible to connect an Adafruit Memento in the same way and use it with OpenCV. I will file that away as a potential future project.

Beyond OpenCV drivers, I did find some research papers about auto-focus. This is great, because research papers usually include an overview section that describes prior work in the field. This helps anyone who wants to get up to speed. If they can find a few papers in the field, they can look over the citations list. Any common citations are likely to point to foundational work and a good place to start. I skimmed through my first two hits: Robust Automatic Focus Algorithm for Low Contrast Images Using a New Contrast Measure (2011) and a more recent paper Learning to Autofocus (2020) applying some machine learning to the problem. My comprehension was pretty low, I can tell I have a lot to learn before I can really follow these papers.

So there's a lot of work... what about the reward side of the equation? Right now my Adafruit Memento is the only camera where I could even try to do anything hands-on. Running autofocus in my own software is going to be far slower than the existing hardware component. And what might I be able to do with such a thing that's interesting and different from existing autofocus? Right now I don't have any ideas, which means not much motivation, resulting in a poor work-to-reward ratio. Until a suitable idea arises to motivate me to dive in to the field, autofocus will remain a passing curiosity sitting at a low priority in my project to-do list.