Advertisement
Guest User

openClase6

a guest
Nov 29th, 2015
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.09 KB | None | 0 0
  1. ofDrawCircle(ofGetWidth()/2, ofGetHeight()/2, amplitud);
  2. grayBg.draw(20,20);
  3. grayDiff.draw(20,300);
  4.  
  5.  
  6. // or, instead we can draw each blob individually from the blobs vector,
  7. // this is how to get access to them:
  8. for (int i = 0; i < contourFinder.nBlobs; i++){
  9. contourFinder.blobs[i].draw(20,600);
  10.  
  11. // draw over the centroid if the blob is a hole
  12. ofSetColor(255);
  13. if(contourFinder.blobs[i].hole){
  14. ofDrawBitmapString("hole",
  15. contourFinder.blobs[i].boundingRect.getCenter().x + 20,
  16. contourFinder.blobs[i].boundingRect.getCenter().y + 600);
  17. }
  18. }
  19.  
  20. // finally, a report:
  21. ofSetHexColor(0xffffff);
  22. stringstream reportStr;
  23. reportStr << "bg subtraction and blob detection" << endl
  24. << "press ' ' to capture bg" << endl
  25. << "threshold " << threshold << " (press: +/-)" << endl
  26. << "num blobs found " << contourFinder.nBlobs << ", fps: " << ofGetFrameRate();
  27. ofDrawBitmapString(reportStr.str(), 20, 600);
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement