03 May 2013

Taking refocusable images using MagicLantern

If you a professional or hobbyist photography, you undoubtedly have heard about the Lytro. For those of you who haven't, the Lytro is a camera that uses "light-field technology" to allow more information about the light that is coming into the camera be stored. This information, in turn, can be used to perform a variety of functions, the most apparent of which is the ability to re-focus a picture after the picture has been taken. Its very exciting technology, but for those of you who already own an expensive DSLR its a bit disappointing that the technology is currently only available on Lytro cameras and DSLR manufacturers have yet to announce any comparative technologies in their cameras. Do not despair, however, because the refocusing functionality can actually be faked with DSLRs or any camera with a manually refocusable lens!

I recently ran across this Reddit post to a Chaos Collective website that demonstrated a simple little webapp that could replicate the refocusable images that Lytro can output for HTML5 browsers. It actually was pretty neat, but other than the fact that the subject of your image had to remain still for the duration of the refocusing process, there was still one other thing that was particularly bothersome for me: you had to touch your camera to manually adjust the focus, which could potentially shift the image slightly and ruin the experience. I knew there was some way to do this refocusing but have the camera do it for me, automatically and without me having to touch the lens, and there is - at least for some Canon DSLRs.
There is a great piece of custom firmware called MagicLantern (ML) that is available for some Canon DSLRs that can add a bunch of powerful features to a stock Canon DSLR - for free! These features include the ability to take more shots in an HDR, HDR video, focus trapping, and rack focusing. The rack focus feature in ML allows you to set the range of focus that you want and record a video where the camera can then automagically change the focus within the desired range while recording. With this feature, combined with the Chaos Collective webapp, you can setup your scene in your camera, pick the far focus point and the near focus point, then automatically record the video and provide it to the webapp to make a refocusable image without touching the camera's lens to perform the refocusing!
Here's a short summary of how it works (assuming you have MagicLantern already installed on your camera):

  1. Set up the camera on a tripod and frame the subject in your scene.
  2. Set the camera in video recording mode.
  3. Set the lens into manual focus and adjust the focus to the "near" focus point.
  4. Reset the lens into autofocus mode. DO NOT TOUCH THE SHUTTER BUTTON.
  5. Bring up MagicLantern and go to the Focus tab.
  6. Use the arrow buttons to highlight "Focus End Point" and press Set.
  7. You will now see a LiveView picture of the scene. Press the Left arrow button to change the focus to the "far" focus point and press Set.
  8. Now, highlight "Rack focus" and press Set. The camera will now automatically change the focus back to where you started.
  9. Click the Play button and the camera will automatically begin recording and adjusting the focus.
  10. Once finished, download the generated video to your computer & convert it to a web format (e.g. MP4 or WebM). This part is hard and requires a lot more detail than I want to get into here, but there are converters out there that can help with this.
  11. Now, visit the Chaos Collective website and use the webapp.
  12. VoilĂ ! You're very own refocusable image!
I know it seems like a lot of work, but I went into a lot more detail on how to properly set up MagicLantern for this post and is actually pretty easy once you get used to MagicLantern and its controls. Converting videos is a whole other discussion that I don't think I can get into here. But with MagicLantern, there is a whole slew of things you can do! In fact, with Magic Lantern, you can use HDR video, rack focus, a bit of video post-processing and the Chaos Collective webapp and make refocusable HDR images! Pretty neat stuff if you ask me!

No comments: