Coder Social home page Coder Social logo

ofxmacamps3eye's Introduction

#ofxMacamPs3Eye Fully featured and easy to use OpenFrameworks addon for using the PS3Eye camera on a Mac. The addon uses a stripped down version of Macam, specially tweaked for the PS3Eye and so let's you use multiple cameras, access high FPS, provides an API to control gain, shutter, brightness, contrast, etc and even let's you blink the LED! The addon implements the ofBaseVideoGrabber, so it will work out of the box exactly how is expected of the default ofVideoGrabber.

##Usage Include the addon as you would do with any other (using OF's new project generator or by dragging and dropping the folder to Xcode) and use the ofxMacamPs3Eye object as you would do with the ofVideoGrabber. Then there are a few more goodies you can use.

The basics

in testApp.h:

#include "ofxMacamPs3Eye.h"    

class testApp : public ofBaseApp{
public:
	(...)
	ofxMacamPs3Eye ps3eye;
};

in testApp.cpp:

void testApp::setup(){
	ps3eye.initGrabber(320, 240);
}
void testApp::update(){
	ps3eye.update();
}
void testApp::draw(){
	ps3eye.draw(0,0);
}

####Controls Some juicy controls to use…

// Turn on/off auto gain and shutter
ps3eye.setAutoGainAndShutter(false);    

// All of these accept normalized (0..1) parameter's
ps3eye.setGain(0.5);    /* only if auto gain and shutter is off */
ps3eye.setShutter(1.0); /* only if auto gain and shutter is off */
   
ps3eye.setBrightness(0.6);
ps3eye.setContrast(1.0);
ps3eye.setHue(0.0);
ps3eye.setGamma(0.5);

// Different modes
ps3eye.setFlicker(0); /* 0 - no flicker, 1 - 50hz, 2 - 60hz */
ps3eye.setWhiteBalance(4); /* 1 - linear, 2 - indoor, 3 - outdoor, 4 - auto */

// Turn the LED on/off
ps3eye.setLed(false);

####Listing and using multiple cameras While ps3eye.listDevices(); works exactly like ofVideoGrabber (just print the camera list in the console), the static call to ofxMacamPs3Eye::getDeviceList() will provide you a vector with information of all devices for dynamic initialization.

vector<ofxMacamPs3Eye*> cameras;
vector<ofxMacamPs3EyeDeviceInfo*> deviceList = ofxMacamPs3Eye::getDeviceList();

for (int i = 0; i < deviceList.size(); i++) {
	ofxMacamPs3Eye * camera = new ofxMacamPs3Eye();
	camera->setDeviceID(deviceList[i]->id);
	camera->setDesiredFrameRate(180);
	camera->initGrabber(320, 240);
	cameras.push_back(camera);
}

####And more You can also control the frame-rate and resolution, but for those it's maybe better if you poke with the source code yourself as there are still some sharper corners (and some broken stuff) and the implementation might change slightly in the future.

##Known issues

  • Calling close() it's not really closing the camera properly, it won't jam it or anything in case you want to use the camera with another application later, but if you try to initGrabber() more than once during runtime (for example to change resolution), it will complain the camera is busy.

##Credits The big credits of this addon should go for everyone who collaborated in the Macam project for this camera to actually work on a mac. But the idea of using the source of Macam itself (and not the quicktime component) in a addon is by Jason Van Cleave, who made PS3EyeWindow. Credits also to Kyle McDonald and his fork of the PS3EyeWindow where I saw the idea of using a delegate to interface with the driver and camera central. I've basically just copied and pasted most of that code, gave it a lot of love to allow multiple cameras to work and shaped it as a proper ofxAddon.

##Change log

  • v2.2.0 - Upgraded listDevices that now returns a vector of ofVideoDevice (thanks @jmwohl)
  • v2.1.0 - Removed osx 10.6 SDK dependencies

ofxmacamps3eye's People

Contributors

andyinabox avatar crishoj avatar hanasaan avatar jg33 avatar jmwohl avatar paulobarcelos avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

ofxmacamps3eye's Issues

Example links are broken & text load needs update.

Hey.
The links of the ofxMacam addon are broken in all examples. Just deleting the reference and dragging the src folder back in to xcode worked.

In ofxMacamPs3Eye::update() of ofxMacamPs3Eye.mm I replaced
tex.loadData( getPixels(), getWidth(), getHeight(), GL_RGB);
with
tex.loadData( getPixelsRef() );

I am using xcode 0.8.4

cannot compile buil failed sensor.m

with xcode 4.6.2 and montain lion 10.8.3 i cannot compile this addons. the error is in this method:

of_v0.7.4_osx_release/addons/ofxMacamPs3Eye-master/src/macam/Sensor.m:90:21: Unexpected type name 'register_array': expected expression

  • (int) setRegisterArray:(struct register_array *) array
    {
    while (array->bus != register_array::END_OF_ARRAY)
    {
    if (array->bus == register_array::CONTROLLER_REGISTER)
    {
    [controller setRegister:array->reg toValue:array->val];
    }
    else if (array->bus == register_array::SENSOR_REGISTER)
    {
    [self setRegister:array->reg toValue:array->val];
    }
    else
    {
    return -1;
    }
    array++;
    }

    return 0;
    }

GenericDriver.m fails building with SDK newer than 10.6

I am on the current master brunch of OF and ofxMacamPs3Eye and using Xcode 4.5.2 on OSX 10.7.
It compiles fine with the SDK 10.6, but Xcode 4.5 removed the native support for SDKs older than 10.7.

/Users/me/Projects/Development/openFrameworks/addons/ofxMacamPs3Eye/src/macam/GenericDriver.m:1904:5: Use of undeclared identifier 'GetGWorld'
/Users/me/Projects/Development/openFrameworks/addons/ofxMacamPs3Eye/src/macam/GenericDriver.m:1905:5: Use of undeclared identifier 'SetGWorld'
/Users/me/Projects/Development/openFrameworks/addons/ofxMacamPs3Eye/src/macam/GenericDriver.m:1909:27: Use of undeclared identifier 'GetGWorldPixMap'
/Users/me/Projects/Development/openFrameworks/addons/ofxMacamPs3Eye/src/macam/GenericDriver.m:1914:5: Use of undeclared identifier 'SetGWorld'
/Users/me/Projects/Development/openFrameworks/addons/ofxMacamPs3Eye/src/macam/GenericDriver.m:1915:5: Use of undeclared identifier 'DisposeGWorld'
/Users/me/Projects/Development/openFrameworks/addons/ofxMacamPs3Eye/src/macam/GenericDriver.m:1941:40: Use of undeclared identifier 'GetGWorldPixMap

Kills area light

As soon as I add this addon to the arealight example, it kills it in a sense that the light looks awful.

I don't even have to enable the cam, simply adding the addon is enough to achieve this.

With addon
screen shot 2014-09-09 at 6 32 33 pm

WIthout addon.
screen shot 2014-09-09 at 6 33 04 pm

Any pointers as to why this may be happening?

Can't compile on OF073 on a 10.6.8 system ...

hi Paulo !

i'm Eloi Maduell ... OF belover from Barcelona .
i've trying to compile and test the "example-gui" example from ofxMacamPs3Eye but can't make it work.
I'm compiling it with XCode 3.2.4 on a 10.6.8 Snow Leopard laptop ... with OF073 ...

the errors i got on compilation are:

/example-gui/../../../addons/ofxMacamPs3Eye/src/PS3EyeWindowAppDelegate.h:48: error: unknown property attribute
/example-gui/../../../addons/ofxMacamPs3Eye/src/PS3EyeWindowAppDelegate.h:48: error: syntax error in @Property's attribute declaration
/example-gui/../../../addons/ofxMacamPs3Eye/src/ofxMacamPs3Eye.mm: In member function 'virtual void ofxMacamPs3Eye::setDeviceID(int)':
/example-gui/../../../addons/ofxMacamPs3Eye/src/ofxMacamPs3Eye.mm:53: error: expected unqualified-id before '=' token
/example-gui/../../../addons/ofxMacamPs3Eye/src/ofxMacamPs3Eye.mm:54: error: expected unqualified-id before '=' token

Any idea of what i'm doing wrong ?
Thanks for your support .

e*

Support MDI-style windowing for multiple cameras example

Instead of constraining the multiple cameras example app to a single window, it would be really cool if the two windows were detachable from each other. That way they could be placed in specific places in any orientation on the screen, suitable for screen recording with the cameras alongside whatever other content.

This would also allow the video source to be 640x480 in each window without a single overly wide canvas.

MDI means Multiple Document Interface. Think browser multiple windows, image editors (Photoshop, Pixelmator), etc.

ComponentDispatchHelper.c misses 'Components.k.h' under of_v0.9.8 and MacOS 10.12

Hi,

I get the error, that 'Components.k.h' is missing though CoreServices.frameworks (where I found Components.k.h) is linked.
image

The error is accompanied by COMPONENT_BASELINE, COMPONENT_GLOBALS and COMPONENT_UPP_SELECT_ROOT not being defined.
image

The error comes from ComponentDispatchHelper.c
Prior, I fixed to miss QuickTime.h by running against 10.11 SDK
https://forum.openframeworks.cc/t/quicktime-quicktime-h-file-not-found/24494

Any suggestions?

Compiling

In order to get everything compiled properly, when adding to an existing project. All .m files should be renamed to .mm, so you don't have to go and set compile as Objective-C++ manually.

openFrameworks dependency

would it be possible to provide idiot guide to implement for those not familiar with oF?

component installation is rather trivial in comparison )

would like to use, but dont yet understand how to install

Mavericks, of008, cannot set camera to 320x240

I want to connect multiple cameras and im assuming i'll want a smaller resolution to conserve usb bandwidth, but i cannot use the ps3 eye camera on osx 10.9 at anything other than 640x480

camWidth = 640;
camHeight = 480;

ps3eye.listDevices();

ps3eye.setDesiredFrameRate(30);
ps3eye.initGrabber(camWidth,camHeight);

Works too well (high fps + high res)

First thanks for the library. I'm running the self titled example and finding that despite setting the frame size to 640,480 and the frame rate to 60, the example is reporting 100 fps. I am sort of inclined to believe it, it looks hyper smooth. Nonetheless, if we set the frame rate to 60 it seems like it should run at 60.

The second issue I'm seeing is that when I decrease the resolution to 320x240 I don't get any frames, just white.

Lastly, If I keep the frame size at 640x480 and bump the fps to 180, the frame rate slows to around 60.

I'm on a new macbook running OS X 10.9.4

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.