Hello - I probably have no business doing this as a noob, but I needed to be able to control a DSLR camera and analyze the pictures from it and thought I’d try to do it in OF. I found a good library from Apple of Objective C code from their Image Capture SDK that works well for scanning camera capabilities, automatically triggering the shutter, and downloading photos. Pretty useful.
Anyway, I tried to mash these files into OF and, after some fiddling am down to only 11 errors! They all seem to be in the genre of Objective C things that won’t compile, such as NSString. A complete list of errors is here.
I began with just the OF blob tracking code and an trying to build this in. I’ve uploaded the code if anyone would like to take a look -it-is-here. Followed a couple of the tutorials online (you’ll notice I changed .m to .mm per the suggestion of these) but I’m obviously missing something.
I’d love to be able to use these libraries if anyone has any suggestions. Thanks!
In the future if you get errors like this at the linking stage it will usually be that the app is missing a framework - so if you google the Error with the word “framework” then you should be able to easily find which framework you are missing.
ie google “NSMutableArray framework”
Hope that helps!
Camera triggering sounds very exciting would you mind posting another app when you have a simple demo up and running?
Thank you for looking into it. There are a few other possibilities for camera triggering that I’ve been looking into (gphoto) - this seemed to work the best though - sad it’s not compiling. I’ll keep you updated if I come up with anything.
fyi – I have had good luck w/ canon powershot sdk (with a G7/G9) recently for a project. only works on a pc (not on vista though) and it not so hard to use. We have code around if you need to give it a try. I guess they are discontinuing the sdk, but they also have one for the DSLR line (eos, etc). Great quality and can save to disk / load into OF quite easily…
I’ve successfully used it with Processing and am going to make a wrapper for it in ofw as using it on something now.
“PSRemote also includes a DLL and a sample program (complete with C++ source code) which allows other applications to release the camera’s shutter and adjust the shutter speed and aperture.”
Hmm on seconds thoughts I am not sure how you will include the objective-c code within the OF code.
You definitely want to keep the Objective-C code as contained as possible. The best way I’ve found to create generic interfaces to platform-specific functionality (including different languages like ObjC) is with the PIMPL idiom. What’s really nice about it is that it allows you to separate the logic of how things are controlled from the actual implementation.
The basic idea is to include an opaque pointer (usually with something like
std::auto_ptr<Implementation> mImpl;
) where Implementation is the opaque platform-specific class. The class Implementation will be forward-declared and defined in a .cpp or .mm so it remains hidden from anything that might include the header file. For an example, see the following source files that demonstrate the use of PIMPL for a platform agnostic Window class:
Hmm on seconds thoughts I am not sure how you will include the objective-c code within the OF code.
You definitely want to keep the Objective-C code as contained as possible. The best way I’ve found to create generic interfaces to platform-specific functionality (including different languages like ObjC) is with the PIMPL idiom. What’s really nice about it is that it allows you to separate the logic of how things are controlled from the actual implementation.
The basic idea is to include an opaque pointer (usually with something like
std::auto_ptr<Implementation> mImpl;
) where Implementation is the opaque platform-specific class. The class Implementation will be forward-declared and defined in a .cpp or .mm so it remains hidden from anything that might include the header file. For an example, see the following source files that demonstrate the use of PIMPL for a platform agnostic Window class:
I’ve successfully used it with Processing and am going to make a wrapper for it in ofw as using it on something now.
“PSRemote also includes a DLL and a sample program (complete with C++ source code) which allows other applications to release the camera’s shutter and adjust the shutter speed and aperture.”[/quote]