Quantcast
Channel: beginners - openFrameworks
Viewing all articles
Browse latest Browse all 4929

Animating Points within ContourFinder

$
0
0

@s.kiam wrote:

Hey guys! I’m new to OF and playing around with contour finder and ofxCV. I want to make points move around inside the contour, and am slightly confused how to get the points or do that. Do I need a convex Hull? For now I have this in draw:

int n = contour.size();
for(int i = 0; i < n; i++) {
ofPoint center = toOf(contour.getCenter(i));//center point of contour
double area = contour.getContourArea(i);//area of contour
ofPolyline polyline = contour.getPolyline(i);
auto vertices = polyline.getVertices();
for (int p=0; p<100; p+=1) {
ofVec3f point = polyline.getPointAtPercent(p/500.0);
ofDrawCircle(point, 2);

For now, a contour outlined with dots appear. However, I am not sure how to make the dots move or bounce around inside the contour, and am not sure if that’s how I get the contour extremes/points? I know how to make a polyline but am not sure how to get the points for it, I’m guessing I need a points class too?

Would appreciate any help, thank you!

Posts: 1

Participants: 1

Read full topic


Viewing all articles
Browse latest Browse all 4929

Trending Articles