hi, i was experimenting with the opencv example that comes with of fat version , how can i get the countour data from contourFinder? i need to have that data inside a vector? how can i do that?
thanks
hi, i was experimenting with the opencv example that comes with of fat version , how can i get the countour data from contourFinder? i need to have that data inside a vector? how can i do that?
thanks
Once you’ve called contourFinder.findContours(…), the contours will be stored per blob in a vector of ofxBlobs called blobs, so it would be accessed by contourFinder.blobs. In each blob there’s a vector called pts, which is the coordinates of the contours, below is an example of how to access this info.
for(int i = 0; i < contourFinder.blobs.size(); i++) { // loop through blobs
for(int j = 0; j < contourFinder.blobs[i].pts.size(); j++) { // loop through points in blob
// this is the j'th coordinate of the contour for the i'th blob
ofPoint p = contourFinder.blobs[i].pts[j];
}
}
Hope that makes sense.