the ImageCapture SDK baffles me

Dear Lazyweb, I'm lost in a maze of twisty APIs, all alike.

So, this thread seems to be talking about exactly the kind of thing I'm trying to accomplish: find a connected camera; ask it what capabilities it has; and then send (undocumented) PTP commands to it to do other things, like grab the current viewfinder image.

But, the code posted in that thread references symbols that I can't find any documentation for or definitions of, like kICAMessageCameraPassThrough (which seems to be the ICAObjectSendMessage() argument that lets you compose raw PTP commands). That sounds like something that should be in ICACamera.h or one of the other ICA headers in ImageCapture.framework, but it's not.

Then I found Image Capture SDK for Mac OS X v10.4 (from here) which contains those symbols. So, this sounds like, I have to install this API in order to do these things. A little odd that it's not installed by default, but whatever.

But... WTF is this thing? This DMG doesn't include an installer. It includes an XCode project that builds an application, not a framework (and that application appears to do nothing).

This must be some new usage of the word "SDK" with which I was previously unfamiliar.

    Update: Current best guess is that there is no installer because the ImageCapture API is pre-installed on 10.x as a part of Carbon... but, what's in this DMG documents some hypothetical future version of this SDK, so a bunch of interesting symbols that really oughta someday be a part of it are just dumped willy-nilly into the sample application?

And to add insult to injury, the definitions of the structures in the header files use C++ syntax that doesn't work from Objective C code. Nice. (Update: apparently .mm means "ObjC++" which is a bastard hybrid that mostly works.)

Can any of you make any sense out of this? Or do you know someone at Apple who might be able to? Since that mailing list archive helpfully obfuscates email addresses (fuck you, you fucking fucks) I can't even mail any of the people involved in that thread to ask for clues.

I did get a copy of Canon's "official" SDK, but it looks kind of horrible, so I'd rather do things by following the Apple Party Line instead, since that really seems like it would have to be the least painful route. (Likewise for any approach that involves trying to port some janky-assed Linux software to MacOS.)


Maybe I should be doing this with some other API instead, but I can't tell. The USB stuff in IOkit.framework seems way too low level; like, I saw no way to ask a device, "are you a camera? do you provide pictures?" but only ways to ask them things like, "are you product 0x1ABC from vendor 0xFF0A?"

Something I read somewhere said that Quicktime was the way to go for getting images out of still cameras, but my experience with all the Quicktime-related docs on developer.apple.com is that they are basically, "this is how it used to work in MacOS 8." What's up with that?

Tags: , , ,

14 Responses:

  1. ivorjawa says:

    With the C++ part of it, at least, you're covered. The last several revisions of gcc have supported a hideous mutant called Objective C++, allowing full miscegenation of C++ and objc.

  2. duskwuff says:

    ...my experience with all the Quicktime-related docs on developer.apple.com is that they are basically, "this is how it used to work in MacOS 8." What's up with that?

    Because most of it hasn't changed, with the exception of a few thin wrappers (NSMovie and NSMovieView). Quicktime is a cross-platform technology - the Windows QT API is basically identical - and it hasn't changed a lot since its creation.

    • jwz says:

      Yeah well, any time I've tried to actually use any of the QT APIs, gcc has issued warnings about obsolete functions (e.g. QTNewGworld()), suggesting that Apple thinks I ought to be using something else (and that I ought to magically know that, without them coming right out and saying it.)

  3. blasdelf says:

    One of the few people that might be able to help you is Wil Shipley at Delicious Monster. I talked with him at an apple developer conference a month ago, and he is the guy when it comes to using the Quicktime frameworks to control cameras (iSights in his case) - he is the only person that's figured out how to focus the iSight cameras. I would guess he's spelunked through the Image Capture stuff too - he's probably your best bet.

    I've used Image Capture a bunch for scanning (to avoid using the terrible Epson Scan software), and it also has some issues, just different ones from the Epson crap.

    • wjsdelicious says:

      Unfortunately, ImageCapture is an unrelated framework to QuickTime... Well, possibly fortunately, because ImageCapture looks to possibly be cleaner, but unfortunately, because I've never touched ImageCapture.

      I would like to learn it, so users could hook up still cameras to their computers and do Delicious Library's cool barcode scanning with still cameras as well, but that's in THE FUTURE.

  4. korgmeister says:

    (Most likely the latter. Beacuse this is the lazyweb after all.)

    My Kodak Easyshare CX6330 has a TV-out port that can output the viewfinder image through a regular RCA cable provided with the camera.

    Until now, I thought it was the most pointless feature imaginable (perhaps that's why they eliminated it from later models). But if that sounds easier than all this bollocks you're trying, you might want to try eBaying an old CX6330.

  5. ahruman says:

    I can't really say anything useful about using cameras in Tiger. What I can absolutely not say under any circumstances is that this stuff is supposed to be much easier in Leopard. There was some stuff about this in the WWDC Developer State of the Union session, which was released to online ADC members via iTMS last week or so. (Unfortunately, I don't have a link here. I may do at home.) I get the impression that they intend to support non-iSights, but I don't know how well.

  6. chipaca says:

    There are at least some reports of success using gphoto2 for what you mention, using the operating system of your choice. You probably already knew this. So I created an account to add basically nothing to the discussion. I blame the time of day.