Magic Lantern Forum

Developing Magic Lantern => General Development => Topic started by: RudiChen on March 10, 2014, 07:09:04 PM

Title: Question on ML capabilities in controlling lens focus
Post by: RudiChen on March 10, 2014, 07:09:04 PM
Dear Magic Lantern developers,

I'm a researcher currently doing work to increase autofocus speed and accuracy. I'm looking at using ML to test the algorithm and I'd like to know which of the following are possible, if any, by writing a script or modifying the ML code and recompiling :
1) Make the lens take a small, medium or large step forward (to far focus) or backwards (to near focus).
2) Determine the exact number of lens positions on a lens for focusing.
3) Determine the exact position of the lens in terms of focus, in number of lens steps.
4) If possible to move the lens, determine whether we've reached the last lens position.
5) Obtain an image from the liveview and computing something such as the histogram in real-time.

Your assistance is greatly appreciated.
Title: Re: Question on ML capabilities in controlling lens focus
Post by: dmilligan on March 10, 2014, 07:29:09 PM
You can only control the lens in LiveView and it's very slow, but it is possible. AFAIK, it's not possible to figure out where the lens is in number of steps and it's not possible to know if you've reached the end.

You can do image analysis of the LV, there are many examples (50% of ML features are basically image analysis of the LV). On most cameras you have access to raw image buffers as well as YUV 422 that is used for the display. As far as it being 'real-time' it depends on what you're trying to do, the CPU is pretty slow.
Title: Re: Question on ML capabilities in controlling lens focus
Post by: walter_schulz on March 10, 2014, 07:43:07 PM
Birger RS-232 adapter comes to mind:
http://www.birger.us/products/lens_controller/manuals/canon_ef232/Canon%20EF-232%20Library%20User%20Manual%201.3.pdf
http://www.magiclantern.fm/forum/index.php?topic=3796.0

Ciao
Walter
Title: Re: Question on ML capabilities in controlling lens focus
Post by: Marsu42 on March 10, 2014, 08:13:48 PM
Quote from: dmilligan on March 10, 2014, 07:29:09 PM
AFAIK, it's not possible to figure out where the lens is in number of steps and it's not possible to know if you've reached the end.

Afaik in focus stacking, ML does throw an error "focus limit reached". Since this is hopefully always at the same position, you can then backtrack to any position you want with the usual focus steps also used in focus stacking & rack focus.

Everything else the op wants sounds like ML can do it, the different step sizes are the same used by EOS utility.
Title: Re: Question on ML capabilities in controlling lens focus
Post by: RudiChen on March 11, 2014, 06:18:24 PM
Quote from: dmilligan on March 10, 2014, 07:29:09 PM
You can only control the lens in LiveView and it's very slow, but it is possible.

Would you happen to know how slow? I've noticed that the camera's native can move the lens at about 6 steps/second (regardless of size), ignoring phase-detect, whereas the peak speed that can be obtained using the Canon SDK and controlling through the USB cable is about 3 steps/second.

Thank you for your help folks!