简体   繁体   中英

Canon EDSDK Command TakePicture blocks everything after focus error

I'm using the Canon SDK 2.1 and i am trying to take a picture at the camera from C# code. I started a session (EdsOpenSession) and everything works fine with this line of code:

EDSDK.EdsSendCommand(cameraDev, EDSDK.CameraCommand_TakePicture, 0);

the camera takes a picture and stores it on memory card.

The problem is here: if there is an AF error (eg the lens cap is on), the camera gets 'BUSY' and never gets back.

Also if i try to shut down the EDSDK with the functions EdsCloseSession or EdsTerminateSDK, they blocks. The only thing to get it up again is to restart the application and the camera. I'm using an EOS 100D.

What can i do to get ignore these AF error and try to take another picture?

I have also just had this issue.

I have solved it by Sending a half button press to focus followed by a full button press to take the photo if that succeeds.

try
{
    EDSDK.EdsSendCommand(cameraDev, EDSDK.CameraCommand_PressShutterButton, 1); // Half
    EDSDK.EdsSendCommand(cameraDev, EDSDK.CameraCommand_PressShutterButton, 3); // Completely
}
finally
{
    EDSDK.EdsSendCommand(cameraDev, EDSDK.CameraCommand_PressShutterButton, 0); // Off
}

I have the same problem with Canon EOS 1100D, but I've found http://digicamcontrol.com which is open source. They've managed to make autofocus working, but I haven't found what exactly they did. Maybe you can find it. I if you do, please share the solution.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM