View Full Version : Software rack focus


Tramm Hudson
July 14th, 2009, 10:46 PM
I've posted a short video showing an upcoming Magic Lantern feature: software focus pulls. This is a demonstration of how smooth the software control can be with a very fine step size. It is doing 30 steps/sec in the video with a stepsize of 1 and speed of 1.

Magic Lantern - Software rack focus test on Vimeo (http://vimeo.com/5603517)

James Miller
July 15th, 2009, 12:17 AM
Great work Tramm. Very smooth video clip, had to play it back to see the focus change.

Does the camera register what step position the lens is currently at? I mean can you preset a step position 1 and 2. Can this also be routed to the bottom dial/wheel?

This has the potential to be a great ML feature.

Well done, you must be totally consumed with the camera.

Jon Fairhurst
July 15th, 2009, 12:36 AM
This is amazingly cool.

Any idea of how to do the user interface? I see two possibilities, one that's self contained and another that uses external control.

For the self-contained version, having a single button press (even better - IR trigger for use on a gimbal rig) to start a pre-programmed rack focus would be excellent. The distance and duration could be loaded in a (the) config file. An S-curve could be applied, either in-camera or baked into a config sequence.

The extra step of loading the parameters into the card isn't too bad. Setting up a dynamic rack focus shot takes a fair amount of time to setup anyway. A minute of burning a file on the card would be well worth it to get a butter smooth transition with a perfect end point.

Multiple transitions - each manually triggered - would be amazing.

Dan Chung
July 15th, 2009, 01:10 AM
Tramm, that is brilliant. How are you currently setting the start and end points?

Do you think you in future we could integrate this with some kind of controller app for PC, Mac, pocket pc or Iphone?? I know that pocket phojo on windows mobile can control some camera functions so it may be possible without a proper computer or netbook, if we could connect a device like this to the camera and then control it from another on a peer-to-peer network it would be amazing.

Dan

Tramm Hudson
July 15th, 2009, 06:11 AM
How are you currently setting the start and end points?
Right now they are open loop. My program just iterates 512 steps at 30 Hz in one direction when the "Rack focus" menu is selected. I may add something similar to the older Canon DEP mode (http://www.luminous-landscape.com/tutorials/dep.shtml) -- you could manually rack the focus to the start and end points, have the camera record the positions and then execute the rack at the desired speed. Or, as Jon mentioned, maybe something in a script on the CF card.
Do you think you in future we could integrate this with some kind of controller app for PC, Mac, pocket pc or Iphone??
Or perhaps a standalone device of some sort with a really nice focus knob and controls for all the other camera functions. If the camera is on a jib or a steadicam this would be very, very handy.

I would really like to track down a WFT-E4. The 5D Mark II has a full TCP/IP stack with a built-in webserver. Think about the possibilities there!

Steve Maller
July 15th, 2009, 07:16 AM
I am confused. Do any Canon lenses offer external control of the focus? I didn't think that was possible. Or are you sending signals to some other device?

Chad Dyle
July 15th, 2009, 07:23 AM
Tramm, if this is what you do in your spare time, what is your real job :) We all appreciate the tools that you are creating for us!

Dennis Doerr
July 15th, 2009, 08:26 AM
Or perhaps a standalone device of some sort with a really nice focus knob and controls for all the other camera functions. If the camera is on a jib or a steadicam this would be very, very handy.

A precise remote follow focus without the lensgear & gearbox thing... just the Canon USM, that sounds awesome!

Tramm, great work and great ideas! I will donate some $$$ for sure.

Dennis
from Germany

Jon Fairhurst
July 15th, 2009, 08:56 AM
I am confused. Do any Canon lenses offer external control of the focus?

Of course. That's how they provide autofocus to still photographers. The camera sends the signal and the lens has the motor.

Hugh Mobley
July 16th, 2009, 10:51 AM
would the Magic Lantern void the Canon Warranty,

Matthew Roddy
July 16th, 2009, 11:02 AM
Tramm, That is AWESOME!
I had programmable buttons on my old Sony Z1u, where I could set up Button 1 for X focus and then Button 2 for Y focus and then rack between the two. I really missed being able to do that, and here you come with that feature for our 5DM2! That's brilliant!!!

Wayne Avanson
July 16th, 2009, 11:08 AM
Very nice Tramm

Some exciting possibilities there I think

Avey

Jon Fairhurst
July 16th, 2009, 11:37 AM
would the Magic Lantern void the Canon Warranty,

Magic Lantern does not burn into the ROM, so it is similar to the CHDK firmware project.

You can read about how CHDK affects the Canon Warranty here:
FAQ - CHDK Wiki (http://chdk.wikia.com/wiki/FAQ)

From a practical standpoint, I doubt that Canon service would be able to detect if 3rd party code had ever been loaded.

Denis OKeefe
July 16th, 2009, 12:01 PM
I've been using Nikon (all manual) lenses, with this I may have to change. I'm guessing there is no motor function to the Canon zoom lenses. If I'm wrong and I hope I am, would this allow programed zooms (not that the world hasn't seen quite enough zooms already - but just in case one more is needed).

Tramm Hudson
July 16th, 2009, 12:14 PM
I'm guessing there is no motor function to the Canon zoom lenses.
There is the incredibly rare 35-80 mm f/4-5.6 PZ. I don't know if the zoom functions can be commanded through the EF lens protocol or if it only zoomed in response to the buttons on the lens body. I don't see any mention of it in the 5D Mark II firmware.

Steve Maller
July 16th, 2009, 12:51 PM
Of course. That's how they provide autofocus to still photographers. The camera sends the signal and the lens has the motor.

Whoa. And duh. Of course. :-)
That's a wonderful feature. That alone may make me start using ML.
Thanks.

Tramm Hudson
July 17th, 2009, 06:36 AM
I've posted a short video showing an upcoming Magic Lantern feature: software focus pulls. This is a demonstration of how smooth the software control can be with a very fine step size. It is doing 30 steps/sec in the video with a stepsize of 1 and speed of 1.
Now that my camera's batteries are recharged, I've done some more analysis and found that there are not separate stepsize and speed controls; instead it is a signed 16-bit value for the number of counts. Positive is a longer focus distance, negative is a shorter focus distance.

Here is a better video showing a range of speeds: Magic Lantern - software rack focus speeds (http://vimeo.com/5634812)

These were generated by selecting the different speeds from the Magic Lantern menu and hitting "Test rack focus". If I had thought about it, I would have written a short program to loop over the desired speeds and reset the focus to 0.85 m after each one. That way the video wouldn't have any edits at all and would demonstrate something approaching scriptability (in C).

The slow speeds work fairly well (although there is still an occasional hiccup), but since the AF motor seems to only run at full speed when commanded with PROP_LV_FOCUS, it is hard do a smooth, fast focus pull. The really fast pulls even over-shoot the desired 2.9 m distance. I'm hoping that there is another command that allows a selectable focus speed.

When focusing with the "focus by wire" 85 mm f/1.2 L, does it seem to have multiple smooth speeds or does the lens always jump to the new focus distance? If anyone has one that I can use for non-destructive testing near Charleston, or if you just aren't happy with it and want to trade it for my 85 mm f/1.8, you know how to reach me.

Chris Barcellos
July 18th, 2009, 11:54 AM
Very nice, Tramm. Is this long term project or do you think this is coming to ML 0.1.6 ?

Tramm Hudson
July 18th, 2009, 02:57 PM
Is this long term project or do you think this is coming to ML 0.1.6 ?
There will be some support for it in 0.1.6, but I'm not sure what the interface will be. It will likely be at the scripting level for now, until we figure out how to best expose it to the user.

Jon Fairhurst
July 18th, 2009, 03:08 PM
My preference for simplicity is a script or series of scripts that can be triggered by IR. That lets people with gimbal rigs trigger measured focus pulls without upsetting the balance. This application is probably the most in need of a remote, no-tension solution.

Live use, with a knob, will take more tinkering...