From 404746784ce6ef2b87c396a12451947fee28b244 Mon Sep 17 00:00:00 2001 From: Tim Redfern Date: Wed, 24 Jan 2018 23:40:49 +0000 Subject: colourPolyline --- drawing/src/colourPolyline.cpp | 21 +++++++++++++++++++++ drawing/src/colourPolyline.h | 18 ++++++++++++++++++ drawing/src/ofApp.cpp | 11 +++++++---- drawing/src/ofApp.h | 2 ++ notes | 19 +++++++++++++++++++ 5 files changed, 67 insertions(+), 4 deletions(-) create mode 100644 drawing/src/colourPolyline.cpp create mode 100644 drawing/src/colourPolyline.h diff --git a/drawing/src/colourPolyline.cpp b/drawing/src/colourPolyline.cpp new file mode 100644 index 0000000..810488d --- /dev/null +++ b/drawing/src/colourPolyline.cpp @@ -0,0 +1,21 @@ +#include "colourPolyline.h" + +void colourPolyline::addVertex( const ofPoint& p , const ofColor& c){ + ofPolyline::addVertex( p ); + pointColours.push_back( c ); +} + +void colourPolyline::addVertex( const ofPoint& p ){ + addVertex( p , ofColor(255,255,255)); +} + +void colourPolyline::draw(){ + for (int i=0;i pointColours; + +}; \ No newline at end of file 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 shapes; + vector 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; } diff --git a/drawing/src/ofApp.h b/drawing/src/ofApp.h index a6f03a6..1667334 100644 --- a/drawing/src/ofApp.h +++ b/drawing/src/ofApp.h @@ -7,6 +7,8 @@ #include "ofxSyphon.h" #include "ofxOpenCv.h" +#include "colourPolyline.h" + class ofApp : public ofBaseApp{ diff --git a/notes b/notes index c0f05d4..5a7209b 100644 --- a/notes +++ b/notes @@ -8,3 +8,22 @@ what's required -> prioritise - animated outlines - fading - clipping - an interface + + +think about the pipeline + +video inputs +- playback +- syphon + +shape inputs: +- graphics/ drawings +- tracing video +- generative + +- controls inputs +- midi +- lfo +- audio + +- colours - coloured polyline \ No newline at end of file -- cgit v1.2.3