edsdk-python icon indicating copy to clipboard operation
edsdk-python copied to clipboard

Help with Canon EDSDK: Error 0x61 during photo transfer!

Open Wackelpudding3000 opened this issue 1 year ago • 1 comments

Hello GitHub Community,

I am working on a project where I aim to capture images with a Canon camera and transfer them to my PC using the Canon EDSDK. However, I am encountering a persistent issue: Error Code 0x61 appears whenever I try to transfer a captured image from the camera to the PC.

You can download the Python script as a ZIP file here: https://github.com/user-attachments/files/18269265/camtest.zip

  1. Error Description:

    • The camera is correctly detected and initialized.
    • The photo is successfully captured.
    • When attempting to download the image using EdsDownload, the error 0x61 is returned.
  2. Steps Taken:

    • Set the storage target to "Host" using EdsSetPropertyData.
    • Configured host capacity using EdsSetCapacity.
    • Verified all functions return success until the image transfer step.
  3. Environment:

    • Language: Python with ctypes (bindings for Canon EDSDK)
    • Operating System: Windows 10
    • Camera: Canon EOS 1300D
    • Canon EDSDK Version: latest
  4. Failing Method:

    result = self.edsdk.EdsDownload(dirItem, 0xFFFFFFFF, stream)
    
  5. Attempts to Fix:

    • Tested different storage targets (e.g., camera storage instead of host).
    • Adjusted capacity values.
    • Added debugging and logging to identify potential issues.

Despite these efforts, the error persists. It seems the issue may lie in the camera configuration or how the image object is referenced.

Goal: Enable the camera to successfully transfer a captured image to the PC.


Steps to Transfer Photos (Based on Canon EDSDK Manual):

1. Initialize the SDK:

  • Use EdsInitializeSDK to start the SDK.
  • Load the EDSDK library and verify initialization success.

2. Detect the Camera:

  • Call EdsGetCameraList to retrieve the list of connected cameras.
  • Check the number of cameras using EdsGetChildCount.
  • Use EdsGetChildAtIndex to select a camera from the list.

3. Open the Camera Session:

  • Open the camera session with EdsOpenSession.

4. Configure the Camera:

  • Set the camera's storage options to "Host" using EdsSetPropertyData:
    EdsSetPropertyData(camera, kEdsPropID_SaveTo, 0, sizeof(kEdsSaveTo_Host), &kEdsSaveTo_Host);
    
  • Specify host capacity using EdsSetCapacity.

5. Trigger the Camera:

  • Use EdsSendCommand to capture an image:
    EdsSendCommand(camera, kEdsCameraCommand_TakePicture, 0);
    

6. Retrieve the Image:

  • Access the captured image using EdsGetChildAtIndex to get a directory item (e.g., the most recent image).

7. Transfer the Image to the PC:

  • Create a file stream with EdsCreateFileStream to specify the destination path on the host.
  • Transfer the image using EdsDownload:
    EdsDownload(dirItem, 0xFFFFFFFF, stream);
    
  • Confirm the download completion with EdsDownloadComplete.

8. Close the Session and Terminate the SDK:

  • Close the camera session using EdsCloseSession.
  • Terminate the SDK using EdsTerminateSDK.

Common Issues:

  • Error 0x61: Occurs if the storage target or capacity is incorrectly set.
  • No Camera Detected: Check connections and drivers.
  • Download Failure: Ensure the directory item is correctly referenced.

What might be causing this error, and are there specific areas I should investigate to resolve the issue? Any help would be greatly appreciated. Thank you!

Wackelpudding3000 avatar Dec 29 '24 11:12 Wackelpudding3000

Did you installed the edsdk-python package? I looked at the code you provided and saw that you are using ctypes but I didn't see any reference to the package's methods and implementations. I'm working with a Canon R50 and I capture thousands of photos per day. I followed the example code provided in the package, with a few modifications, and it's working fine.

Try running a test by installing and configuring the package, following the project's readme.

Here is the test script that performs photo capture https://github.com/Jiloc/edsdk-python/blob/main/examples/save_image.py

gustavo-alberto avatar Dec 31 '24 00:12 gustavo-alberto