Friday, December 21, 2007

Programming with the Canon IXUS and EOS Digital Camera

I recently came across a business model which I thought was very interesting. Its essentially a mobile photo studio (or a photo booth) that can be setup easily in events or venues such as birthday parties, event launchings, weddings and many more. They basically charge a fixed fee (anywhere from P10k to P20k) for a finite number of hours (2 to 5 hrs). During that period, the event/party guests can ham it up in front of the camera and they get free souvenir prints.

In the event that I first saw this setup, I took a peek inside the contraption and saw a Canon EOS 20D. Aha! There must be a way to programmatically control a camera from a PC; retrieve the still images that it captures; lay it out in a memory bitmap; then dump it out to a photo printer. Sounds like an interesting project!

So I Googled around to know what tools are out there. First, I found an open-source project in Sourceforge under the GNU General Public License (GPL):

http://canoncam.sourceforge.net/

It seems to be a bunch of command-line utilities which can control a Canon digital camera. However, in order to use it, one has to have the Canon RC SDK. Hmm.... what could that be? Doing more Google searches, I found out that Canon offers the SDK to allow application developers to talk to their camera. Best of all, its for free! One just has to go through the application process:

http://www.canon-asia.com/index.jsp?fuseaction=dev_prog&prod_type=digital_imaging

So I diligently filled up the forms. I figure I would need the standard Canon Digital Camera Software Development Kit (CD-SDK 7.3.0) to support the older Powershot and IXUS lines, and the newer Canon EOS Digital Software Development Kit (ED-SDK 2.1) for the digital SLR lines. My old IXUS 400 (aka Powershot SD400) is supported by the older CD-SDK, while my EOS 400D (aka Digital Rebel XTi) would be supported by the newer ED-SDK.

Based on the website, the libraries are written in Windows C. But some guys seem to have made a C# wrapper around it.

  1. Elias Torres made a C# wrapper around the CD-SDK. But it seems very dated. And for sure, it does not support the newer ED-SDK.
  2. Christian Graus and Benjamin Liedblad came out with a unified version for the CDSDK and PRSDK (a newer version of the CDSDK), but also no mention of the ED-SDK.

Well, my CD from Canon Singapore arrived the other day (after about a 3-week wait). I tried plugging in my old IXUS 400 to my PC. Couldn't seem to get the CD-SDK sample programs to detect it. I wonder if its because I did not really install the entire drivers CD of the IXUS 400. My PC only has the drivers/programs installed from my EOS 400D camera. This will take some more tests.

On the bright side, I found out that the EDSDK came shipped with a C# class file! There's no documentation whatsoever, but it doesn't seem too difficult to figure out since its basically just a class that defines entry points to the EDSDK.DLL. I think I'll focus my development on the EDSDK and forget about the older CDSDK. Of course, this means that whatever application I develop will have to use an EOS Digital Camera and not a lower-end IXUS. Will update this blog more as I find out more also about the EDSDK.

4 comments:

Unknown said...

Out of interest, did you manage to get the software to identify the IXUS 400? I'm trying to do some remote capture and can connect to my 350D OK, but it fails to recognise an IXUS 400. I've installed the latest WIA drivers, but wonder if there are more items needed before the SDK will 'see' the camera.

Dick Chiang said...

Nah... I never bothered. :P I just stuck to experimenting with my EOS400D.

Unknown said...

Hi,

I have a question (a stupid one).
I have both cdsdk and prsdk dlls but how in the visual C program should I use them? should I just copy them to the source folder of program or where the C program is installed?

Dick Chiang said...

Since I'm using a Canon EOS400, I'm using the EDSDK. But I would think the CDSDK/PRSDK would work similarly. You just need to "Add Reference" to the DLL. You can copy it to your debug/release folder if you want. Or you can just reference it from your project to wherever it is that you installed the CDSDK (ex. c:\cdsdk).