Quantcast
Channel: openFrameworks - Latest posts
Viewing all articles
Browse latest Browse all 40524

How Interact with ContourFinder(Contour detected -OfxOpencv),blobs VS Some kind of objects,like a simple circle or a system particle for instance?

$
0
0

Have you tried to use my last code?

for (int i = 0, int numBlobs = contourFinder.blobs.size(); i < numBlobs; ++i){
    ofxCvBlob & blob = contourFinder.blobs[i];
    ofVec2f c( blob.centroid.x, blob.centroid.y );
    ofVec2f v = p - c;
    float d = v.length();
    float f = 10000 / d / d;
    v = v.getNormalized() * f;
    p += v;
}

Put it in update, like you did with my first example (the one with the mouse).

And don't forget to draw something to view the result, at the end of draw(). An ofCircle for example, like in my first example. [edit] Ooops, I just see you already do it, sorry.
But you can use p.x and p.y to set the position of any object you want to draw, why not an ofImage.


Viewing all articles
Browse latest Browse all 40524

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>