3

I would like to send a command to focus the camera, then turn the auto focus feature off, then take photos. This is to avoid the time it takes to focus between each photo. Is this possible? I have a program fully written, but this is the last piece of the puzzle.

user2027231
  • 169
  • 2
  • 19

2 Answers2

3

There is a more precise way to detect what is actually happening after the focus starts. First, you can tell if the focus succeeded and also you can tell when the focus finished, so you don't need to wait too long.

The operation is different in LiveView and in normal mode. I have tested it in LiveView, but the documentation states some difference in normal mode. Anyway, this is for LV:

Use the first command as you did:

MainCamera.SendCommand(CameraCommand.DoEvfAf, kEdsCameraCommand_EvfAf_ON);

then periodically check the kEdsPropID_FocusInfo property to detect if some of the focus points are in focus.

The documentation is plain incorrect in this on my camera (5D Mark IV), because the returned focus points have a justFocus value, which should be 0 or 1 according to the docs, but it isn't!

Instead, I found that justFocus has at least these values:

  • 16 = Unknown focus state and currently not focusing
  • 17 = Focused succesfully and focusing is paused (in one-shot mode). However, the focusing is still in "On" mode, so you have to change it to "Off" using the command below, otherwise some operations like zooming won't work.
  • 18 = Focus failed
  • 20 = Focused succesfully and focusing is still in progress (in AF Servo mode)

My tactics is to scan through the returned focus points and search for successful or failed focus. If found, I will then stop the focusing process by calling:

MainCamera.SendCommand(CameraCommand.DoEvfAf, kEdsCameraCommand_EvfAf_OFF);

Vit Kovalcik
  • 436
  • 3
  • 12
  • Hi, I cannot find just focus property. I have PropertyID.FocusInfo, I cant find none of its values. A help is deeply appreciated, Regards – smoothumut Jan 19 '18 at 13:14
  • It has been a long time and I am using some EDSDK wrapper for C#, which covers things a bit. However, if you retrieve the data for the FocusInfo property, you should get a EdsFocusInfo struct, part of which is the focusPoint array (EdsFocusPoint structures). Each of the focus points has its own justFocus variable. – Vit Kovalcik Jan 20 '18 at 14:29
  • I get 128 focuspoints on my 1100d. Isn't that too much? ( ´CanonSDK.GetPropertyData(MainCamera.Reference, PropertyID.FocusInfo, 0, out fi); ´ ) – daniel Apr 17 '18 at 20:10
  • the values makes no sense for me. do I only have to check the points of the pointNumber AF Frame? – daniel Apr 17 '18 at 20:37
  • 128 focus points in LiveView makes sense - they are just possible rectangles that can be used to focus. – Vit Kovalcik Apr 19 '18 at 12:05
  • Do it like this: for (int i = 0; i < PointNumber; i++) { x = FocusPoints[i].JustFocus; if ((x == 17) || (x== 18) || (x == 20)) { /* command to stop focusing here */ break; } } – Vit Kovalcik Apr 19 '18 at 12:08
1

Here is what I found.

focusing is a bit problematic with the Canon SDK. But for your case I think the simplest thing would be this:

MainCamera.SendCommand(CameraCommand.PressShutterButton,(int)ShutterButton.Completely);
//Wait for some time here and if the photo wasn't taken, call:
MainCamera.SendCommand(CameraCommand.PressShutterButton,(int)ShutterButton.Completely_NonAF);
//Then, in either case, call
MainCamera.SendCommand(CameraCommand.PressShutterButton,(int)ShutterButton.OFF);

Or if you are using the live view you have to do something like this:

MainCamera.SendCommand(CameraCommand.DoEvfAf, 1);
//Wait for some time here
MainCamera.SendCommand(CameraCommand.DoEvfAf, 0);
MainCamera.SendCommand(CameraCommand.PressShutterButton,(int)ShutterButton.Completely_NonAF);
MainCamera.SendCommand(CameraCommand.PressShutterButton,(int)ShutterButton.OFF);

Hope this helps someone, as I have looked long and hard for this.

user2027231
  • 169
  • 2
  • 19