naztronaut / edsdk-python

Canon EDSDK wrapper for Python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

edsdk-python

Python wrapper for Canon EOS Digital Software Development Kit, aka EDSDK.

Currently, it supports Windows only. But it shouldn't be difficult to adapt it for macOS.

How to build

Obtain the EDSDK from Canon

Before you can use this library you need to obtain the EDSDK library from Canon. You can do so via their developers program:

Once you were granted access - this may take a few days - download the latest version of their library.

Copy the EDSDK Headers and Libraries

You should now have access to a zip file containing the file you need to build this library.

Unzip the file and copy the following folders inside the dependencies folder of this project:

  1. EDSDK - Containing headers and 32-bit libraries (we only use the headers!)
  2. EDSDK_64 - Containing 64-bit version of the .lib and .dlls (which we do use!)

Your dependencies folder structure should now look like this:

dependencies/EDSDK/Header/EDSDK.h
dependencies/EDSDK/Header/EDSDKErrors.h
dependencies/EDSDK/Header/EDSDKTypes.h

dependencies/EDSDK_64/Dll/EDSDK.dll
dependencies/EDSDK_64/Dll/EdsImage.dll

dependencies/EDSDK_64/Library/EDSDK.lib

Any additional files aren't needed, but won't hurt either in case you copied the entire folders.

Windows 10 LNK1158 Fatal error: Cannot r un 'rc.exe'

In windows 10, copy rc.exe and rcdll.dll from:

C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x86

Note: Version number folder (e.g. 10.0.20348.0) may be different.

Copy to:

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

Modify EDSDKTypes.h

This file contains an enum definition, called Unknown, which collides with a DEFINE in the Windows.h header.

Therefore needs to be renamed.

typedef enum
{
    Unknown   = 0x00000000,
    Jpeg      = 0x3801,
    CR2       = 0xB103,
    MP4       = 0xB982,
    CR3       = 0xB108,
    HEIF_CODE = 0xB10B,
} EdsObjectFormat;

You can comment out Unknown or rename it to UNKNOWN (or whatever you want) or it won't compile on Windows.

Build the library

Run:

pip install .

Throubleshooting

C2365: 'Unknown': redefinition; previous definition was 'enumerator' : go to the section Modify EDSDKTypes.h and follow the instructions.

About

Canon EDSDK wrapper for Python

License:MIT License


Languages

Language:C++ 63.2%Language:Python 36.8%Language:C 0.0%