Author Topic: Question on ML capabilities in controlling lens focus  (Read 4376 times)

RudiChen

  • New to the forum
  • *
  • Posts: 2
Question on ML capabilities in controlling lens focus
« 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.

dmilligan

  • Developer
  • Hero Member
  • *****
  • Posts: 3218
  • 60Da / 1100D / EOSM
Re: Question on ML capabilities in controlling lens focus
« Reply #1 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.


Marsu42

  • Contributor
  • Hero Member
  • *****
  • Posts: 1557
  • 66d + flashes
Re: Question on ML capabilities in controlling lens focus
« Reply #3 on: March 10, 2014, 08:13:48 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.

RudiChen

  • New to the forum
  • *
  • Posts: 2
Re: Question on ML capabilities in controlling lens focus
« Reply #4 on: March 11, 2014, 06:18:24 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!