ofxMacamPs3Eye

Hey! Just wanted to let you know I’ve just released ofxMacamPs3Eye, an ofxAddon that offers very good interfacing for the Ps3Eye on a mac.

You can set gain, shutter, brightness, blink the LED, use multiple cameras, etc, etc (everything Macam has to offer).

Check it out at https://github.com/paulobarcelos/ofxMacamPs3Eye

wow, fantastic - what a timing!

am just fighting with multiple ps3Eye for an installation…
I’ll check you addon first thing in the morning :slight_smile:

I’m curious if i’ll have to disable the hacked multi-ps3Eye-macam-drivers first…
We’ll see!

Anyway, thanks!

Jan

Your timing is indeed great here Paulo. Thanks for sharing.

I seem to have run into a problem when using it with Kyle’s ofxCV. I’m seeing the errors in the attached image when both addons are used in the same project.

I’ve approached this from several different angles - starting from both ofxMacamPs3Eye and ofxCv example projects. I also had similar errors when adding both addons to an emptyExample project. In all cases I’m ensuring to add the correct headers to the Header search paths.

Any idea what’s happening here?

OS X - 10.6.8
Xcode - 4.2
OF v0071

@janklug Nice, let me know how it goes! You probably have realized this already but the multicameras issue has a lot to do with the USB hubs… Depending on what you what to get from the camera (eg.640x480@60fps) you will only get one camera working per USB hub… So for example in a Mac Mini you will only get 2. Was able though to get 3 x 320x240@30fps, which is enough for the project I am currently working (and I believe with those settings would could even get 4 running, 2 per hub).

@jamesalliban hmmmm… I’ve seen those before… Dont’ remember exactly what it was but I think something with the ofxCv/OF branch. For me it works using the following:

  • Making sure the opencv headers are getting included correctly (I usually just include both ofxCv and ofxOpenCv so I am sure the include paths will be there)
  • Building (both your project and openFrameworks) against MacOS 10.6 SDK.
  • Using the “opencv-2.3.1” branch of ofxCv.
  • Using the “develop” branch of OF, latest from github.

I am attaching a sample project, but I am on Xcode 4.4.1, OSX 10.7.4

ofxMacamPs3Eye_ofxCv.zip

Thanks for the example project Paulo. It worked straight out the box.

I managed to get rid of most of the errors by removing an older version of ofxCV, cleaning the project, changing the compiler and a bunch of other tricks. I was still left with the dreaded Mach-o linker error. Looking through your project I noticed you had included the ofxOpenCv addon. I added this in my project and it worked! I didn’t think you needed to include this addon if you are using ofxCV and including the correct header search paths as in Kyle’s examples. Weird.

Thanks for the add-on!

For some reason, to fix the compiling issues above, I have to rename all “.m” file to “.mm”, may be because there is mixed Objective-C and C++ code in there.

Cheerz,
Kamen

@kamend, interesting… actually I did that before only for the “objective c++” files, in theory, all the other .m files in the project are pure objective c. But I am far from an expert in objective c, so I could be doing something wrong… Maybe someone with more experience into mixing both languages could point us some direction…

Btw, what version of xcode you are using?

Hi, i’m trying to compile this on 10.8 : I get a message complaining that ofxMacamPs3Eye is an abstract class in testApp.h ofxMacamPs3eye ps3eye.

I try to declare ps3eye as a pointer to ofxMacamPs3eye but it returns more error.

if anyone can point me in the right direction ta would be great.

E

To work out the “abstract class” issues, you just need to define all virtual functions from ofBaseVideoGrabber inside ofxMacamPs3Eye, because few are missing. Just add this:

bool setPixelFormat(ofPixelFormat pixelFormat) { return true;}
ofPixelFormat getPixelFormat() { return OF_PIXELS_MONO;};
void videoSettings() {}
void setVerbose(bool bTalkToMe) {}

These functions does not serve any purpose, so the return values are just for the sake of having a correct definition. Use this as a temp fix.

The suggested fixes have been merge to the main repo!
https://github.com/paulobarcelos/ofxMacamPs3Eye

Wow, this is really fast… great great job Paulo! Runs perfect on OF 0.071 with OSX 10.8, running the 10.6 SDK.

I tried to run compile it at OF 0.073 but had no luck… There are a lot of strange errors…

What would be needed to port it to 0.073 and the OSX 10.8 SDK?

I’ve got it - well, the examples - to port to 0072 / 0073 by doing what is needed in general to get the live video capture ready for those versions on OSX - adding the CoreVideo, QTKit, and Accelerate system frameworks…

See this-thread for details…

I am having a different problem, though…
I can 't seem to add this addon to a new project (or literally even copy/paste the example project) and have it compile without errors…

At the very least I’m getting errors in ‘Sensor.m’ and ‘GenericDriver.m’ …

Would LOVE any ideas/feedback…

xo

~ J

![](http://forum.openframeworks.cc/uploads/default/2680/Screen Shot 2012-12-06 at 10.55.20 AM.png)

![](http://forum.openframeworks.cc/uploads/default/2682/Screen Shot 2012-12-06 at 10.58.35 AM.png)

hi jesses.co.tt ¡¡

did u got to solve this errors ? i am getting Semantic Issue error compiling ofxMacaPS3Eye in a XCode 4.5 with OF 0073 in OsX 10.8.2 …

OF-0073/addons/ofxMacamPs3Eye/src/macam/Sensor.m:88:23: Unexpected type name ‘register_array’: expected expression
OF-0073/addons/ofxMacamPs3Eye/src/macam/Sensor.m:88:25: Expected expression

What i did is just added the ofxMacamPs3Eye folder into my addons in Xcode …
Is needed to change something on the project settings ¿
Anything for going from 10.6 to 10.8 ¿ I checked i-ve 10.6 SDK all arround on the 3 levels /lib app project/

Any help ¿

e

Finally i was able to compile the ofxMAcamPs3Eye in a 10.6 Xcode 3.2.4 osx system …

The various errors i was getting come from the compiler version and i managed to tweak it …

I got an error like :

* unknown property attribute ‘atomic’ … seems like this is good for an Xcode 4.x project, but not for a 3.2.x project … so what i did is follow this thread and just “delete” the ‘atomic’ word … and it worked.

So now i’m able to compile and see my Ps3 eye at 125 fps at 320x240 … that’s the fastest i can see … even it’s setup to a desired framerate of 180 fps what i get is 125 fps … ?¿

e*

Any luck sorting out the unexpected type name issues in 10.8? Weirdly, the example file runs fine, even with baseSDK set to 10.8 provided I add the standard 10.8 frameworks (QTKit, CoreVideo). Yet adding the addon to my project makes these errors appear. Any thoughts would be great as we’d love to keep using this ps3eye for our installation but need to install on clean machines so really want it to work in mountain lion.

DOH! need to learn to read better, changing the .m files to .mm fixed that right up, got it running just fine.

I’ve just pushed a v2.1.0 update where all OSX 10.6 SDK dependencies were removed. Works fine on my environment XCode 4.5, OSX10.7.5. Would be great if someone could test in other setups…
https://github.com/paulobarcelos/ofxMacamPs3Eye

Thanks Paulo… will test here and respond…

Hi everyone,

I recently started testing this. Thanks for the hard work, Paulo. I’m running osx 10.6.8 and xcode 3.2.6. Originally I got the same errors as a lot of people. The “atomic” error and the “expected unqualified-id before ‘=’ token” error. I fixed the first by simply deleting atomic as was suggested in a related post. And I fixed the second by looking at ofxMacamPs3Eye.mm and changing the ‘id’ variable name in lines 52-55 to ‘id2’ (any other name) but did not change “deviceList[0]->id”. And for some reason, xcode was happy with that.

After doing that, I could run the examples on my setup no problem. But when I tried to add this addon to my own project, I immediately got the weird errors that other people have experience. So I changed all the .m files in the src to .mm files and again things compiled.

However, now I’m getting a very odd error. It is saying “terminating due to uncaught exception”. I looked at the debugger and tried to add some breakpoints, and I can see this info:

2013-06-22 12:07:30.611 osxVideoRecorderExampleDebug[2990:a0f] MyCameraCentral:startupWithNotificationsOnMainThread
2013-06-22 12:07:30.616 osxVideoRecorderExampleDebug[2990:a0f] cameraDetected MyCameraCentral
2013-06-22 12:07:30.616 osxVideoRecorderExampleDebug[2990:a0f] -[MyCameraCentral getName:forID:]: unrecognized selector sent to instance 0x15854000
2013-06-22 12:07:30.617 osxVideoRecorderExampleDebug[2990:a0f] An uncaught exception was raised
2013-06-22 12:07:30.617 osxVideoRecorderExampleDebug[2990:a0f] -[MyCameraCentral getName:forID:]: unrecognized selector sent to instance 0x15854000
2013-06-22 12:07:30.618 osxVideoRecorderExampleDebug[2990:a0f] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[MyCameraCentral getName:forID:]: unrecognized selector sent to instance 0x15854000’

I have added the entire debug print out at the end of this post. It is also letting me know that there is some conflict between the macam driver and ofxMacamPs3Eye implementations of certain things. I don’t know if that means I need to delete my macam driver or if I can do something else to make it look at the ofxMacamPs3Eye version when I’m in a project with that addon. I’m really very confused by this error. I’m not sure if it’s something I did or if someone else has seen it before.

Any suggestions? And thanks again to everybody for figuring out some of the previous issues and for Paulo writing this in the first place.

Whole debug output:

[Session started at 2013-06-22 12:07:30 -0400.]
GNU gdb 6.3.50-20050815 (Apple version gdb-1515) (Sat Jan 15 08:33:48 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type “show copying” to see the conditions.
There is absolutely no warranty for GDB. Type “show warranty” for details.
This GDB was configured as “x86_64-apple-darwin”.tty /dev/ttys001
Loading program into debugger

Program loaded.
run
[Switching to process 2990]
Running

objc[2990]: Class MyCameraDriver is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class MyCameraInfo is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class CyYeGMgConverter is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class BayerConverter is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class MyCameraCentral is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class GenericDriver is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class LookUpTable is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class Sensor is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class OV538Driver is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class OV534Driver is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class Histogram is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class AGC is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
objc[2990]: Class FrameCounter is implemented in both /Users/barragan/Documents/cppCode/of_v0073_osx_release/apps/myApps/osxVideoRecorderExample2/bin/osxVideoRecorderExampleDebug.app/Contents/MacOS/osxVideoRecorderExampleDebug and /Library/QuickTime/macam.component/Contents/MacOS/macam. One of the two will be used. Which one is undefined.
2013-06-22 12:07:30.611 osxVideoRecorderExampleDebug[2990:a0f] MyCameraCentral:startupWithNotificationsOnMainThread
2013-06-22 12:07:30.616 osxVideoRecorderExampleDebug[2990:a0f] cameraDetected MyCameraCentral
2013-06-22 12:07:30.616 osxVideoRecorderExampleDebug[2990:a0f] -[MyCameraCentral getName:forID:]: unrecognized selector sent to instance 0x15854000
2013-06-22 12:07:30.617 osxVideoRecorderExampleDebug[2990:a0f] An uncaught exception was raised
2013-06-22 12:07:30.617 osxVideoRecorderExampleDebug[2990:a0f] -[MyCameraCentral getName:forID:]: unrecognized selector sent to instance 0x15854000
2013-06-22 12:07:30.618 osxVideoRecorderExampleDebug[2990:a0f] *** Terminating app due to uncaught exception ‘NSInvalidArgumentException’, reason: ‘-[MyCameraCentral getName:forID:]: unrecognized selector sent to instance 0x15854000’
*** Call stack at first throw:
(
0 CoreFoundation 0x93ecd6ca __raiseError + 410
1 libobjc.A.dylib 0x99d565a9 objc_exception_throw + 56
2 CoreFoundation 0x93f1a90b -[NSObject(NSObject) doesNotRecognizeSelector:] + 187
3 CoreFoundation 0x93e73c06 ___forwarding___ + 950
4 CoreFoundation 0x93e737d2 _CF_forwarding_prep_0 + 50
5 macam 0x1681d3c7 sgpnRegister + 574
6 CarbonCore 0x9a9e5dcc _ZL38CallComponentFunctionCommonWithStoragePPcP19ComponentParametersPFlvEm + 54
7 macam 0x1681d183 sgpnMainEntry + 87
8 CarbonCore 0x9a9de5e1 CallComponent + 192
9 CarbonCore 0x9a9de51f CallComponentDispatch + 29
10 CarbonCore 0x9aa6cdee CallComponentRegister + 37
11 CarbonCore 0x9aa0ca0a _ZL13kissComponentP15ComponentRecord + 182
12 CarbonCore 0x9a9d6ff1 processSerialKissers + 179
13 CarbonCore 0x9a9d5fe0 registerSystemComponents + 307
14 CarbonCore 0x9a9d5dd1 _Z25FindNextComponentInternalP15ComponentRecordP20ComponentDescriptionm + 86
15 CarbonCore 0x9a9d5d64 FindNextComponent + 61
16 QuickTime 0x98b28f0d EnterMovies_priv + 411
17 QuickTime 0x98b28a36 EnterMovies + 16
18 TundraUnits 0x15631663 TundraUnitInputFromTSFileEntry + 13682
19 TundraUnits 0x15636952 TundraUnitVDIGInputEntry + 21145
20 CoreMediaIOServices 0x97764272 TundraUnitCreateFromDescription + 654
21 QTKit 0x99cbb0be +[QTCaptureVDIGDevice _refreshDevices] + 390
22 QTKit 0x99cba3a7 +[QTCaptureVDIGDevice devicesWithIOType:] + 62
23 QTKit 0x99cb701b +[QTCaptureDevice devicesWithIOType:] + 205
24 QTKit 0x99cb6b0c +[QTCaptureDevice inputDevices] + 42
25 QTKit 0x99cb6a52 +[QTCaptureDevice inputDevicesWithMediaType:] + 36
26 osxVideoRecorderExampleDebug 0x0008b8b0 +[QTKitVideoGrabber listVideoDevices] + 54
27 osxVideoRecorderExampleDebug 0x0008c888 _ZN14ofQTKitGrabber16listVideoDevicesEv + 90
28 osxVideoRecorderExampleDebug 0x0000d828 _ZN7testApp5setupEv + 290
29 osxVideoRecorderExampleDebug 0x0006eede _Z13ofNotifySetupv + 32
30 osxVideoRecorderExampleDebug 0x0006ac03 _ZN15ofAppGlutWindow21runAppViaInfiniteLoopEP9ofBaseApp + 27
31 osxVideoRecorderExampleDebug 0x0006ba05 _Z8ofRunAppP9ofBaseApp + 192
32 osxVideoRecorderExampleDebug 0x0000b4bb main + 96
33 osxVideoRecorderExampleDebug 0x0000b381 start + 53
)
sharedlibrary apply-load-rules all

I got below linker errors.

Undefined symbols for architecture i386:
  "_WidthOfResolution", referenced from:
      -[MyCameraDriver width] in MyCameraDriver.o
      -[MyCameraDriver findResolutionForWidth:height:] in MyCameraDriver.o
  "_MiniDrawString", referenced from:
      -[MyCameraDriver makeMessageImage:] in MyCameraDriver.o
      -[MyCameraDriver makeOKImage] in MyCameraDriver.o
  "_SetQDRect", referenced from:
      -[GenericDriver initWithCentral:] in GenericDriver.o
      -[GenericDriver setupQuicktimeImageCompression] in GenericDriver.o
  "_ChangeMyThreadPriority", referenced from:
      -[GenericDriver grabbingThread:] in GenericDriver.o
  "_HeightOfResolution", referenced from:
      -[MyCameraDriver height] in MyCameraDriver.o
      -[MyCameraDriver findResolutionForWidth:height:] in MyCameraDriver.o
  "_CStr2CStr", referenced from:
      +[MyCameraCentral localizedCStrFor:into:] in MyCameraCentral.o
  "_CheckError", referenced from:
      _isocComplete in GenericDriver.o
      _startNextIsochRead in GenericDriver.o
      _bulkComplete in GenericDriver.o
      _startNextBulkRead in GenericDriver.o
      -[GenericDriver grabbingThread:] in GenericDriver.o
      -[MyCameraDriver usbGenericCmd:onPipe:BRequestType:bRequest:wValue:wIndex:buf:len:] in MyCameraDriver.o
      -[MyCameraDriver usbSetAltInterfaceTo:testPipe:] in MyCameraDriver.o
      ...
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status

Does anyone know how to fix it? I have tried all things I could come up with…