/*
* ofCvBlob.h
* openFrameworks
*
* A blob is a homogenous patch represented by a polygonal contour. 
* Typically a blob tracker uses the contour to figure out the blob's
* persistence and "upgrades" it with ids and other temporal 
* information. 
*
*/


#ifndef OF_CV_BLOB_H
#define OF_CV_BLOB_H

#include <vector>
#include "ofMain.h"


class ofCvBlob {
  
    public:

    float 			area;
    float 			length;
    ofRectangle 	box;
    ofPoint 		center;
    bool            hole;
    vector<ofPoint> contour;
    
    //----------------------------------------
    ofCvBlob() {
        area 		= 0.0f;
        length 		= 0.0f;
        hole 		= false;        
    }
    
    //----------------------------------------
    void draw(float x = 0, float y = 0){
        ofNoFill();
        ofSetColor(0xffffff);
        ofBeginShape();
        for (int i = 0; i < contour.size(); i++){
               ofVertex(x + contour[i].x, y + contour[i].y);
        }
        ofEndShape(true);
        ofSetColor(0xff0099);
        ofRect(x + box.x, y + box.y, box.width, box.height);
    }
};


#endif


