Grasshopper

algorithmic modeling for Rhino

Frame differencing in openFrameworks, based on ofxOpenCv and ofxOsc add-on examples. Amount of motion from frame to frame is translated to aperture size in a basic Grasshopper model.

Views: 504

Comment

You need to be a member of Grasshopper to add comments!

Comment by RWNB on May 4, 2011 at 2:49pm

dear caitlin,

many thanks for the detailed explanation.
unfortunately i'm not familiar with openFrameworks.

i look at it.

 

many thanks

Comment by Caitlin Morris on May 4, 2011 at 1:54pm
Hi RWNB,

Thanks for your comments!  Are you familiar with using openFrameworks?  ofxOpenCv and ofxOsc are both included as addons with the OF toolkit.   With the ofxOpenCv library, you can get the number of pixels changing with each frame (in the video, changing pixels are colored white), and save the number of pixels changing to a float.  With the ofxOsc add-on, you can send that number to your gHowl port by sending the float as a message, for example:

//set up an OSC message
ofxOscMessage m;

//set the address for your command
m.setAddress( "/pixelValue" );

//send the value argument.  here, the argument is the OpenCV function for counting the number of changing pixels between video frames.
m.addFloatArg( videoDiffImage.countNonZeroInRegion(0, 0, width, height) );

//send the message
sender.sendMessage( m );

The gHowl port receives the series of numbers (m.addFloatArg()), which can be tied into your GH definition.

I hope that helps you get started - let me know if you'd like more of an explanation of some part.
Comment by RWNB on May 4, 2011 at 11:21am
a very interesting work!

is there a possibility to get more detailed information?
maybe a tutorial on how to get the pictures with ofxOpenCv in grasshopper. would be nice to get an answer.

thanks

About

Translate

Search

Videos

  • Add Videos
  • View All

© 2024   Created by Scott Davidson.   Powered by

Badges  |  Report an Issue  |  Terms of Service