summaryrefslogtreecommitdiff
path: root/drawing/src/ofApp.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'drawing/src/ofApp.cpp')
-rw-r--r--drawing/src/ofApp.cpp11
1 files changed, 7 insertions, 4 deletions
diff --git a/drawing/src/ofApp.cpp b/drawing/src/ofApp.cpp
index 8928df6..d110414 100644
--- a/drawing/src/ofApp.cpp
+++ b/drawing/src/ofApp.cpp
@@ -241,22 +241,25 @@ void ofApp::draw(){
}
case 7: {
movie.update();
+ ofPoint scale=ofPoint(ofGetWidth()/movie.getWidth(),ofGetHeight()/movie.getHeight());
if (movie.isFrameNew()){
colorImg.setFromPixels(movie.getPixels());
grayImage = colorImg;
grayImage.threshold(threshold);
contourFinder.findContours(grayImage, 20, (340*240)/3, 10, true);
}
- vector <ofPolyline> shapes;
+ vector <colourPolyline> shapes;
for (int i = 0; i < contourFinder.nBlobs; i++){
- ofPolyline shape;
+ colourPolyline shape;
for (auto& point:contourFinder.blobs[i].pts){
- shape.addVertex(point);
+ ofVec3f p=point*scale;
+ ofColor c=colorImg.getPixels().getColor(point.x,point.y);
+ shape.addVertex(p,c);
}
shapes.push_back(shape);
segmentsdrawn++;
pointsdrawn+=shape.size();
- contourFinder.blobs[i].draw(0,0);
+ shape.draw();
}
break;
}