#pragma once
#include "ofxCvConstants.h"
#include "ofxCvBlob.h"
#include "ofxCvGrayscaleImage.h"
#include <algorithm>
class ofxCvContourFinder : public ofBaseDraws {
public:
std::vector<ofxCvBlob> blobs;
int nBlobs;
ofxCvContourFinder();
virtual ~ofxCvContourFinder();
virtual float getWidth() const { return _width; };
virtual float getHeight() const { return _height; };
virtual int findContours( ofxCvGrayscaleImage& input,
int minArea, int maxArea,
int nConsidered, bool bFindHoles,
bool bUseApproximation = true);
virtual void draw() const { draw(0,0, _width, _height); };
virtual void draw( float x, float y ) const { draw(x,y, _width, _height); };
virtual void draw( float x, float y, float w, float h ) const;
virtual void draw(const ofPoint & point) const;
virtual void draw(const ofRectangle & rect) const;
virtual void setAnchorPercent(float xPct, float yPct);
virtual void setAnchorPoint(int x, int y);
virtual void resetAnchor();
protected:
int _width;
int _height;
ofxCvGrayscaleImage inputCopy;
CvMemStorage* contour_storage;
CvMemStorage* storage;
CvMoments* myMoments;
std::vector<CvSeq*> cvSeqBlobs;
ofPoint anchor;
bool bAnchorIsPct;
virtual void reset();
};
Comments