0

我使用 EDSDK 来控制佳能 EOS 1200D。

我试试这段代码:

err = EdsOpenSession(_camera);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : EdsOpenSession" << std::endl;
QThread::sleep(5);
err = EdsSetObjectEventHandler(_camera, kEdsObjectEvent_All, handleObjectEvent, (EdsVoid*)&_path);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : EdsSetObjectEventHandler" << std::endl;    
EdsInt32 saveTarget = kEdsSaveTo_Host;
err = EdsSetPropertyData(_camera, kEdsPropID_SaveTo, 0, 4, &saveTarget);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : EdsSetPropertyData kEdsSaveTo_Host" << std::endl;
EdsCapacity newCapacity = {0x7FFFFFFF, 0x1000, 1};
err = EdsSetCapacity(_camera, newCapacity);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : EdsSetPropertyData newCapacity" << std::endl;
err = EdsSendCommand(_camera, kEdsCameraCommand_TakePicture, 0);
if(err != EDS_ERR_OK)
    std::cout << "[ERROR] : takePicture " << err << std::endl;

随着睡眠,我得到EDS_ERR_TAKE_PICTURE_CARD_NG 0x00008D07L错误EdsSendCommand(_camera, kEdsCameraCommand_TakePicture, 0)。没有睡眠,一切都很好。

相机会话是否超时?

4

1 回答 1

1

I had the same problem in C # . I solved the problem by using a Timer component to run the rest of the code . I think the EDSDK not very fond of Threads.

If you are compiling for windows can use the SetTimer function .

The link talks about the function. https://msdn.microsoft.com/en-us/library/windows/desktop/ms644906%28v=vs.85%29.aspx

I hope you can solve your problem.

于 2015-03-22T23:09:14.030 回答