Deprecated: Function set_magic_quotes_runtime() is deprecated in /home/dfmoore/ on line 14
Notes: LibDC1394 and Xcode



LibDC1394 and Xcode

May 13, 10:47 AM


1. grab libdc1394, rev 2 from sourceforge
(there’s a link from the project’s homepage,

2. open terminal, and type “cd “ (thats with an extra space) and drag in the folder you want to open up— in this case, the libdc1394 folder with the file named “configure”. It will end up looking like this:
DAL-Sputnik:~ hobbes$ cd /Volumes/Olympus/MoCap/libdc1394-2.1.0/
hit .
3. type “./configure”
4. type “make”
5. type “sudo make install” and your password when prompted.

6. Open Xcode and create a new project, of type “C++ tool”.
7. Right click on the blue project icon in Xcode and hit “get info”.
8. Navigate to the “build” tab.
9. Find “Header Search Paths” and double click. This should bring up a window where you can add a new path. Clicking on the “+” button lets you type in a new path; add “/usr/local/include”. Hit Ok to close the window.
10. Find “Library Search Paths” next, and add a path like before. This time, add “/usr/local/lib”.
Steps 9 and 10 allow your project to link against the installed libdc1394 library. We have one last step to integrate it into your Xcode project.

11. In the Finder, click on the “Go” menu, and choose “Go To Folder”. Type in “/usr/local/lib”
12. Find a file called “libdc1394.dylib” and drag it into your Xcode project window, on the left side to add it to your list of project files.
13. In the main.cpp file, add this code:

#include <dc1394/dc1394.h>

14. Click “Build and Go” to verify that your project can link against libdc1394. If all goes well, you should see it compile and run, and give you a “Hello, World!” in your console. True, it’s not anything camera related yet, but we’re making sure that everything is correctly connected—which would throw errors at this point, if it wasn’t.

At this point, you can drag in “grab_color_image.c” from the libdc1394 examples folder, uncheck ‘main.cpp’ and build and go with the example. This will use a firewire camera, so be sure you have one hooked up. If successful, you will see a line in your console saying something like:
[Session started at 2009-05-13 19:01:04 -0400.]
Using camera with GUID 8144361000226ba
wrote: image.ppm (921600 image bytes)
FACE has exited with status 0.

You will find a file called ‘image.ppm’ in your build/debug or build/release folder. Photoshop will know what to do with this file, though it might not look correct. That’s okay, chances are that the program wasn’t set up for your camera yet.

If you’ve made it this far, congratulations! Read through the documentation and explore. Next up will be an article on viewing your images in OpenGL, and processing them in OpenCV.