#ifndef _CONTOUR_TO_IMAGE #define _CONTOUR_TO_IMAGE #include "ofCvMain.h" /* * Converts contour points of a polygon into a binary image where background pixels * are black and the shape is white. */ class cvContourToImage{ public: cvContourToImage(){}; cvContourToImage(int _w, int _h); ~cvContourToImage(); // allocates memory for image void setup(int _w, int _h); // takes in array of x and y coordinates, and returns pixels of image with the polygon drawn in white IplImage * convertContourToImage( ofPoint2f * pts, int totalPts); // simplified function (maybe faster?) that takes 4 vertices (does not have to be a quad really...) IplImage * convertQuadToImage( ofPoint2f fQuad[4] ); IplImage * image; private: int w, h; bool bAllocated; CvMemStorage * storage; }; #endif