True IIDC under OSX

Hi all. I’m wondering if anyone has gotten a “true” (non-Apple-iSight) IIDC camera to work with OF. I’m currently playing around with a Point Grey Dragonfly Express http://www.ptgrey.com/products/dx/index.asp. It works out of the box with Astro IIDC but the Quicktime system doesn’t like it. While they both detect it, Skype and iChat report the camera is either in use or not available. I assume this has something to do with the Apple iSight being “based on the 1394 Trade Association’s IIDC 1.30 specification, with several Apple enhancements”.

The video grabber examples don’t work - fails in

  
ofVideoGrabber::initGrabber()  

on

  
SGSetChannelDevice()  

If anyone has any tips on getting this to work, please let me know. My next plan is to get it running with a sample program in libdc1394. If that’s easy, it might be worth rolling said library into OF.

I know this is not really helpful on a mac, but on a pc I typically use the carnegie melon drivers for 1394:

http://www.cs.cmu.edu/~iwan/1394/

you might want to take a look at quicktime, and see if there is something you can do to get it to work. For example, download hacktv first to test if the camera is capturing. on the quicktime mailing list they might be able to help you. also give point grey a call, I would bet they have experience with this… I haven’t seen many issues in the past with firewire camera and mac.

also, search on the opencv mailing list - they sometimes have a lot of info about hooking up cameras.

working with a 1394 lib would be cool though, and likely give you access to more features, like programmatically controlling anything you have access to in the camera (iris, shuttter spead, contrast, etc).

take care,
zach

see also :

http://homepage.mac.com/eric.lee/libcap/

could be helpful
zach

I think most of the problem is around Apple’s iSight using a perverted IIDC standard. As the iSight has become the defacto firewire camera on Apple, true IIDC format cameras generally don’t work well (at all?) with native apps. Quicktime cannot, so far as I can tell, read from these cameras. HackTV Carbon doesn’t work.

As an aside, I was able to get B/W video out of the camera using Processing. Does Processing use Quicktime? I assume it would…

thanks for the note on libcap, zach. I just tried it and it doesn’t work, but I didn’t dig deep enough into the QT API to find where exactly it’s failing. So I’ll progress with libdc1394. It doesn’t use quicktime at all so it should work OK.

Cheers…

Hi PBungelis, did you have any luck using libdc1394 2.0 to get OF and Point Grey cameras talking happily on OSX? I am currently investigating the same problem, with a Dragonfly 2 camera. According to the latest realease of libdc1394 they have full OSX compatibility:

http://damien.douxchamps.net/ieee1394/libdc1394/v2.x/faq/#What-is-libdc1394

Cheers,

Joel

JGL: I’ve not done any more testing. I just had an evaluation camera for one month while I was busy with other projects so I didn’t put much time into it. I suspect libdc1394 should work. Let us know what you find out.

i tried a bit last night when my brain was fried and got as far as making it compile in xcode with openframeworks. but when i started putting them together i got linker issues and quit for the night.

ill probably try again tonight. id love to see if you can get anything working though

More progress yesterday, I am down to three errors with my super basic demo of grabbing a single grey frame from a Dragonfly 2 camera.

I’ll be posting my project later today. Fingers crossed, no errors. Does anyone else have a Point Grey camera so they can test on a different setup?

Cheers,

Joel

I compiled the 2.0 source downloaded from:

http://damien.douxchamps.net/ieee1394/libdc1394/

And then did the usual:

./configure
make
sudo make install

In the terminal, in the untarred folder. The single greyscale grab program works fine.

All the libs and includes are copied into:

/usr/local/

So I copied all of those files out into

of_preRelease_0.05/libs/libdc1394/

And added those paths into the XCode project.

You can download the project here:

http://homepage.mac.com/joelgethinlewis/download/JGL1394Broken8-8-2008-001.zip

As I said above, I am now down to three errors in my OF project.

There is a problem with the conversion of the type dc1394video_mode_t to int.

The other problem is:

  
  
dc1394_log_error("Failed to initialize camera with guid %"PRIx64, list->ids[0].guid);  

and

  
printf("Using camera with GUID %"PRIx64"\n", camera->guid);  

In both cases, the project doesn’t know how to deal with the PRIx64 macro in the printf statements.

With a bit of Google magic I have found this page:

http://h21007.www2.hp.com/portal/site/dspp/menuitem.863c3e4cbcdc3f3515b49c108973a801?ciid=e908efed55f02110efed55f02110275d6e10RCRD

Which says that:

Using PRIx64 is the best way to keep your code as portable as possible. It’s one of the many macros added in C99 and adopted by POSIX.

I haven’t seen that kind of macro use in a printf statement before. Does anyone else have any ideas?

Cheers,

Joel

Hey Joel,

I sent you this over skype, but you were offline. You may have dug this up by now, but I found this:

#define PRIx64 “x”

so you could change:

dc1394_log_error("Failed to initialize camera with guid %"PRIx64, list->ids[0].guid);

to

dc1394_log_error(“Failed to initialize camera with guid %x”, list->ids[0].guid);

Kevin

with kefex’s help, I implemented the:

  
#define PRIx64 "x"   

Change, with the other problem, an explicit cast changed:

  
dc1394video_mode_t video_mode = 0;  

to

  
dc1394video_mode_t video_mode = (dc1394video_mode_t)0;  

Which worked fine.

The new error which surfaced is as follows:

warning in …/…/…/libs/libdc1394/lib/libdc1394.a, file is not of required architecture

I think it might lead back to:

  
  
./configure  
make  
sudo make install  
  

In that I have to compile the library as a Universal Binary? Or perhaps an Intel-only one to play well with the other OF included libraries.

Anyone?

Cheers,

Joel

Latest source can be grabbed here:

http://homepage.mac.com/joelgethinlewis/download/JGL1394Broken8-8-2008-002.zip

I worked a lot on this yesterday, and I found this:

http://arbi.trario.us/2008/05/14/file.80/

which helped SO much. (just download, compile the xcode project, and then:)

it doesnt help much in getting this to be a mac/pc/linux/ extension, but for running on the mac, it was as simple as embedding the framework

(if you dont know how to do that, this video explains it in the second half: http://rentzsch.com/share/embeddingFrameworks.mov )

after that I got the of project i added it to compiling and ripped a bunch of code out of the single frame grab example and tried piping the pixel data into an ofTexture… .which worked out weird, but did give me camera data.

hopefully in the next few hours ill re-write the ofVideoGrabber class to work with dc1394

so i have started writing an ofVideoGrabber class for the 1394 library

heres a link:

www.stfj.net/misc/of1394VideoGrabber.zip

its VERY barebones, and it seems to grab me like 8 frames at once(?) maybe this is just with AVR cameras ( thats all i have to test on )

I’ve been trying to figure out how to get it to give me just one fullsize frame but the documentation on the library is a little weird (great API docs, few examples) and all the code people have put on the net seems to be for a pre-2.0 version of the library… they just made a lot of function changes.

i’m gonna go grab some lunch and think about this, but if anyone wants to take a crack at this that would be awesome. let me know if you figure out anything

zach

Or is this using the pure downloaded library? Did you run into include problems if you used the downloaded library?

Cheers,

Joel

this one uses the framework that i linked up above. I had to include it like you would include an embedded framework.

the framework above though is an xcode project that compiles the pure downloaded library into a framework… so it’s sort of using the pure downloaded library, but with a step in the middle.

theres gotta be a way to do this just with the pure downloaded library, but I kept getting a ton of linker errors because i was doing some include wrong, although it looked like you solved those… it might be worth looking at the framework project and see what it does to compile the library properly, or just by downloading the xcode project and ripping out the libdc1395.a file and seeing if it is ‘of required architecture’ :slight_smile:

incidentally, heres my latest source in an xcode project… it ‘should’ compile and run fine. I got it to compile but I wasnt able to test it because all of our avt cameras are over at the site… i tested it yesterday and it worked just fine though.

one thing to note however, is that a lot of this library has to do with exactly what camera you’re using and the features of that particular camera. trying to set a feature your camera doesnt have, or even setting a feature wrong even though the library tells you that it’s safe to set the setting and very easily hang your app and sometimes requires resetting the camera with whatever included drivers the camera has.

we’ve been using this with AVT Guppys’ and have found that the best way to deal with the cameras has been to set them up on windows machines with avt’s setup program, and then add a line to my code (which isnt in this project) which tells the dc1394 library to load the user settings in bank 1, which is where we saved them on the pc side.

that minimized errors and got everything working properly.

also of note is that in my threaded function i have a bunch of code that I wrote that de-interlaces and grabs a third of the image, this is because the way our cameras work is that they grab 9 small images which combine into 1 large image, but we only wanted 1 small image, so it worked out to just deal with 1/9th of the pixels and not worry about taxing the computer…

this may make your image look weird if you’re not using our particular brand of camera, so you can just rip it out if you dont want it. also note the ‘unlock()’ that i added to testApp if you grabPixels. I probably should have locked AND unlocked from testApp but for some reason i didnt haha…

so anywy, its a little rough in the code, but it should make some sense… sorry… we’re in the middle of a big install and theres not much time to be cleaning code up a ton for distrobution.

zach

www.stfj.net/misc/libdc1394VideoGrabberxcode.zip

Hey Zach,

Thanks for your upload, I downloaded your zip and dropped the folder “libdc1394VideoGrabber” into a folder named “zach_gage” into an “apps” folder in a clean OF 0.05 (addons patched) FAT download.

After compiling the framework in:

apps/zach_gage/libdc1394VideoGrabber/libdc1394/xcode-project

I dropped the framework back into the “openFrameworks.xcodeproj” in:

apps/zach_gage/libdc1394VideoGrabber/

I am hitting two build errors:

  
In file included from /Users/joel/Documents/Projects/dazedMini/fromZach_gage/noSourceControlCleanRelease/apps/zach_gage/libdc1394VideoGrabber/src/main.cpp:2:  
	/Users/joel/Documents/Projects/dazedMini/fromZach_gage/noSourceControlCleanRelease/apps/zach_gage/libdc1394VideoGrabber/src/testApp.h:7:40: error: ofVideoGrabberDeInterlaced.h: No such file or directory  

I can’t find the ofVideoGrabberDeInterlaced.h file anywhere. Any ideas?

Best,

Joel

oh bogus. there shouldnt be any references in there for the videoGraberDeInterlaced…
that was an old file… if you can find where im trying to include it or use it, you can just comment out the lines. it shouldnt be used at all or in there.

sorry about that!

let me know if that makes sense. otherwise ican try and compile a new version and test it out before i post it this time

Hey Zach,

I commented out that h file, and it compiled fine, but I am getting this back from the console when I try to run it:

  
dyld: Library not loaded: @executable_path/../Frameworks/dc1394.framework/Versions/A/dc1394  
  Referenced from: /Users/joel/Documents/Projects/dazedMini/fromZach_gage/noSourceControlCleanRelease/apps/zach_gage/libdc1394VideoGrabber/openFrameworks.app/Contents/MacOS/openFrameworks  
  Reason: image not found  

Any ideas? I am using a Greyscale only camera (B&W Point Grey Dragonfly 2) - but I think this is a bigger problem than that - the app doesn’t even run as yet.

Cheers,

Joel