Help with ofxOpenCv


I am very new to OF (amazing) and I am trying to use the ofxOpenCv addon (everything is very cool but I don’t seem to go further from where I am).

I want to make several circles (actually any form, but to start I am using circles) to move around the contour of a person (or object) that stands in front of the camera. I seem to understand the code quite ok, but I don’t know how to make the circles interact with the blob of the persons silhouette.

Do I need to call a variable out of “ofxCvBlob.h”, directly from “testApp.cpp” or “testApp.h” ??? If so, how do I do that and which variable should I call ???

Well, actually any advice should help!


hey fernando,

here are some suggestions:

check out the opencvExample. you will find:

contourFinder.findContours(grayDiff, 20, (340*240)/3, 10, true);

which does the analysis and makes available the vertices of the blobs in the image. Then in the draw() you will find:

for (int i = 0; i < contourFinder.nBlobs; i++){

this iterates through all the blobs and draws them. what you seem to try getting at is what actually happens in the blobs’ draw method:

void draw(float x = 0, float y = 0){
for (int i = 0; i < nPts; i++){
ofVertex(x + pts[i].x, y + pts[i].y);
ofRect(x + boundingRect.x, y + boundingRect.y, boundingRect.width, boundingRect.height);

So to get the blob’s vertices you can simply loop through each blob’s pts member.

Hope this helps,


It did help me a lot, thankyou Stefan!

Where is the opencv example ?

I don’t have that.

in the download section:

download the FAT version for your compiler/platform. the in apps/addonsExamples you have the openCv example