Portrait Machine installation

This is a project Kyle and I just finished working on.
It is an interactive photography installation that will run in Amsterdam till the end of September.

Blurb:_ Portrait Machine is an interactive photography installation that visualizes the connections between visitors. It makes these connections based on a number of features, such as clothing choice, hair color, facial expression, and composition within the frame. It presents both similarities and differences in these characteristics, remdining us of our connectedness and uniqueness, creating strong visual patterns and playful juxtapositions._

Preview Video here: http://vimeo.com/5171102
More images (including early shots) here: http://impssble.com/photos/PM

Lots of useful code came out of this project so look out for ofxExif, ofxCanonSDK, ofxFace and a bunch more!

Theo and Kyle

WOW :shock: SWEET

Adding to the addons Theo mentioned, ofxColor and ofxCvHaarFinder are already on the forums here :slight_smile:

I’m still working on ofxKmeans, which uses OpenCV to automatically cluster an image/roi into N dominant colors (and return thresholded images for contour finding), or cluster ofPoints into N clusters.

really cool installation, congrats.
particularly looking forward to ofxCanonSDK and seeing what it can do.

congrats, nice project.

tried something similar but used facebook portraits therefore - didn’t worked like i wished, mainly because the image segmentation to separate the people from the background is hard to handle.

Nice one guys, the images look great! Love the face finder triggering the shot too.

You could hire it out at events no problem, like this london photographer does with his booth…

What kind of background were you dealing with?

Here, the solid white wall and fairly controlled lighting help a lot – but it still doesn’t solve cases like this:

That’s where OpenCV comes in handy :wink:

was using facebook ‘friends’ profile pictures. the backgrounds there are all fairly variable. was using open cv watershed algorithm and graphcut (http://people.cs.uchicago.edu/~pff/segment/) but both didn’t produce satisfying results.

[quote author=“julapy”]really cool installation, congrats.
particularly looking forward to ofxCanonSDK and seeing what it can do.[/quote]

Currently it wraps the DSLR EDSK and does the following things (only tested on a Canon 450D).

Remote trigger.
Remote download.
Remote download and delete ( ie pull an image off a camera ).

Enable/Disable live view
Get live view stream as pixels (@ 848 by 576)
Download live view as image sequence (great for getting video out of non-video capable cannons).

Adding other commands is pretty straightforward we didn’t need too much so I could see it being expanded.

Will get the code posted soon.

oh wow, the canon addon sounds good. Exact the think I need for my next installation :wink: looking forward to the release.

haha, those comps are ace, especially like the last one!

Great project, really love it.

Hey Theo,
Which Canon EDSDK did you use for EOS450D?
I can’t seem to find one…

Hi !!

is there any chance to get the ofxCanonSDK??

Recently bought one Canon 5D and I want to try some features that you showed in your project, is really really interesting.

Congrats for your work!!

I’ll let Theo post the Canon SDK wrapper (or at least code snippets?), since that was more his specialty. I also don’t have a camera to test it on right now! Though last I checked, it was heavily intertwined with our specific use (implementing things like countdown-to-photo).

Actually, checking the list again, my G10 might be supported to some degree… I’ll give that a shot.

Anyway, the FAQ from Canon is here:


There’s a compatibility list in the middle, and at the very bottom there’s a link to the request form for an SDK copy.


thank you kyle!
mine is 500D, i’ll try and post the result!!

Here is the canon capture wrapper.
Currently it has only been tested on CodeBlocks on Windows but should work fine for Mac too.

Also included is ofxExif which can tell you the orientation of an image - ofxExif is only partially implemented but could also be useful for people.

    bool setup(int cameraID);   //You must call this to init the canon sdk  
    void destroy();             //To clean up - also called by destructor  
    bool openSession();         //Begins communication with camera  
    bool closeSession();        //Ends communication with camera.  
                                //Note on sessions: Commands like takePicture  
                                //will open a session if none exists. This  
                                //is slower though so consider calling it  
                                //once at the begining of your app.  
    //  CONFIG  
    void setDeleteFromCameraAfterDownload(bool deleteAfter);  
    void setDownloadPath(string downloadPathStr);  
    void enableDownloadOnTrigger();     //Trigger meaning takePicture  
    void disableDownloadOnTrigger();    //Trigger meaning takePicture  
    //  ACTIONS  
    bool takePicture();   //Takes a picture. If enabled it will also download  
                          //the image to the folder set by the download path.  
    //  LIVE VIEW  
    bool beginLiveView();                   //starts live view  
    bool endLiveView();                     //ends live view  
    bool grabPixelsFromLiveView(int rotateByNTimes90 = 0); //capture the live view to rgb pixel array  
    bool saveImageFromLiveView(string saveName);  
    bool getLiveViewActive();               //true if live view is enabled  
    int getLiveViewFrameNo();               //returns the number of live view frames passed  
    void resetLiveViewFrameCount();         //resets to 0  
    bool isLiveViewPixels();                //true if there is captured pixels  
    int getLiveViewPixelWidth();            //width of live view pixel data  
    int getLiveViewPixelHeight();           //height of live view pixel data  
    unsigned char * getLiveViewPixels();    //returns captured pixels  
    string getLastImageName();  //The full path of the last downloaded image  
    string getLastImagePath();  //The name of the last downloaded image  
    //This doesn't work perfectly - for some reason it can be one image behind  
    //something about how often the camera updates the SDK.  
    //Having the on picture event registered seems to help.  
    //But downloading via event is much more reliable at the moment.  
    //WARNING - If you are not taking pictures and you have bDeleteAfterDownload set to true  
    //you will be deleting the files that are on the camera.  
    //Simplified: be careful about calling this when you haven't just taken a photo.  
    bool downloadLastImage();  
    //Hmm - might be needed for threading - currently doesn't work  
    bool isTransfering();   



I’m trying to control an SLR from openFrameworks, and I’m really lucky you guys did this before! I’m waiting to get a reply for the canon sdk, but their site is quite misleading about it being OS X compatible… Do you guys know if I can make this work from a mac?

Hey Armadillu,

I’m currently building an application with Theo’s addon ofxCanonSDK that works great for MAC, only you should pay attetion in some macros like:

#ifdef __MACOS__


Depending on wich version of gcc are you using you might have to change it, I change this macros to __APPLE__ and work for me.

Also you have to put a canon framework inside app package contents in order to run it.

All of this is specified in the CanonSDK document.

We are thinking of recording 1080p video and/or taking high res still with a canon 5D Mark2… But I’d love to know if this can be done seamlessly while in live preview. The cam is very expensive, and we cant just get it blindly to find out it doesn’t behave as we expected…

Ideally, the camera would be set to live preview, so that I can display a live feed on screen… And depending on certain events, I would trigger a single shot or I’d start recording 1080p video form the camera. Anybody knows if that would be possible without stopping the live view? Or with a minimal stop (half a sec or so)? Does the video get streamed to my mac live, or it’s recorded onto the cam’s memory as a h264 mov and I have to retrieve the file myself? If so, how long does it take? And can I still get live preview while transmitting the file?

If the video is streamed, I’ll probably need a raid setup to record the videos at a decent quality, right? I wonder if a core2 duo machine will be able to handle this… aaarg so many questions!

I’m also concerned about the sensor overheating; I would set a minimum rest time between sessions (i believe you have a 5 minute record time limit)

I’ve also thought of using the camera’s HDMI output and buy a HDMI video capture card (Blackmagic’s Intensity seems cheap, doesn’t do 1080p though) to obtain the video… I wonder if someone has tried such approach before?

Grrr I wish that canon sdk petition process was fasterrr so I could find out about all this myself