@s.kiam wrote:
Hello! I’m using ofxCv, and am trying to draw polylines from the points extracted from vector<vectorcv::Point > points.
However, when I add polylines from the points, they join with the contour polylines. How can I have the new polylines from the contour finder and points, without the original traced contour line? I tried polylines.clear() and resizing it but I’m not sure I’m doing it the right way.
I have this, but I want it to only show the polyline without the traced shape of the head.void ofApp::update(){
cam.update();
if (cam.isFrameNew()){
contourFinder.setTargetColor(targetColor, trackHs ? TRACK_COLOR_HS : TRACK_COLOR_RGB);
contourFinder.setThreshold(threshold);
contourFinder.findContours(cam);}
points.clear();
points.resize(contourFinder.size());
for (int i =0; i< contourFinder.size(); i++){
points[i] = contourFinder.getConvexHull(i);
}
}}
//--------------------------------------------------------------
void ofApp::draw(){
//cam.draw(0,0);
gui.draw();
ofSetColor(255,100);
ofSetLineWidth(1);for (int i=0; i< points.size(); i++){ for (int j =0; j<8; j++){ ofPolyline polyline = contourFinder.getPolyline(i); polyline.curveTo(points[0][0].x, points[0][0].y); // These curves are Catmull-Rom splines polyline.curveTo(points[0][0].x, points[0][0].y); // Necessary Duplicate for Control Point polyline.curveTo(points[0][1].x, points[0][1].y); polyline.curveTo(points[0][2].x, points[0][2].y); polyline.curveTo(points[0][3].x, points[0][3].y); polyline.curveTo(points[0][4].x, points[0][4].y); polyline.curveTo(points[0][5].x, points[0][5].y); polyline.curveTo(points[0][6].x, points[0][6].y); polyline.curveTo(points[0][6].x, points[0][6].y); // Necessary Duplicate for Control Point polyline.draw(); } }
}
Let me know, thank you so much!
Posts: 1
Participants: 1