A Pi And A Kinect Autofocus A DSLR
Written by David Conrad   
Sunday, 04 September 2016

It has been a while since we had a wow Kinect project and this one isn't so much wow as just interesting. The idea is simple enough - use a Kinect to create an auto-focus for a DSLR used as a video camera. It is not until you step back for a moment and consider how insane this approach is do you realise how far we have come in so short a time. 

When you think autofocus, the traditional approach is to use a rangefinder that simply brings two images taken from different positions into registration or changes the focus until they are in registration or changes the focus to maximize the contrast. What we are talking about is a simple feedback system with simple software, if any.

This is often fine for a still image, but video is more complicated and while a DSLR makes a really good video camera the autofocus generally cannot work fast enough to follow a moving subject.

Enter the Kinect which can track the movement of an object and provide a distance signal which can then be used to adjust the focus. It is easy at this point to miss that we are not talking about a simple feedback system like an ultrasonic distance sensor. The Kinect is a time of flight distance measurement tool with built in processor and AI software that will track humans and other objects. In many senses this is technological overkill, but just think how much more sophisticated it could be than a simple distance sensor. 




The other intriguing aspect of this project is that it uses a Raspberry Pi as the controller. Usually the Kinect works with a PC but there is a library that works under Linux and with the help of OpenCV you can get a Kinect to do useful work on a Pi.

The final problem is how do you set the focus. The solution in this case is a stepper motor with a very ad-hoc wooden mount. The stepper motor turns the focus ring manually. A better, but more difficult, way might be to use the autofocus motor directly via the camera's USB interface.  

You can see the autofocus in action in this short video, but you have to notice what is going on to make sense of it. The camera is first focused on the object on the right and as it is moved in the focus follows it. 



There are lots of possibilities for taking this further. For example. you could implement a face autotracker that keep a face in focus.

Why stop at focus when you have a Kinect to give you the data. Add a pan and tilt and the camera could autotrack a subject. Add a zoom control and it should be possible to implement a traveling zoom effect where the object is kept the same size in the frame as the camera moves closer and further away. 

Its just a matter of the software. 

The only slightly negative aspect of the entire project is that while Microsoft seems happy publicizing the use of the Kinect with the Pi, it still doesn't have an official Linux driver for the Kinect. In the new era of Microsoft and open source this seems like a missing feature. 



More Information

Building a kinect based focus puller

Focusing on a Pi, Kinect and DSLR for the Perfect Video

Related Articles

Intel Euclid - New Horizons For RealSense

Kinect v1 Being Phased Out

Kinect SDK 2 And An Xbox Adaptor

Grab A Pixel - Real Reality

AquaTop Display - A True Immersive Interface

Kinect plus a glass wedge gives ...

Kinect makes you Superman 


To be informed about new articles on I Programmer, sign up for our weekly newsletter, subscribe to the RSS feed and follow us on, Twitter, FacebookGoogle+ or Linkedin



Google's Large Language Model Takes Control

of a robot. No it isn't Skynet just yet, but it is looking a more likely scenario. Until recently I thought that much of the hype about large language models was just that - hype. Now I'm not so sure. [ ... ]

End Of The Road For Coding Competitions

Google has shocked and disappointed the thousands of developers by abruptly cancelling of all its coding competitions and the sunsetting of their platform. Two days later, news emerged that Topco [ ... ]

More News






or email your comment to: comments@i-programmer.info


Last Updated ( Sunday, 04 September 2016 )