#ifndef VECTORIZATION_H #define VECTORIZATION_H #include #include using namespace std; struct point { unsigned short x; unsigned short y; bool operator==(point pt2) { if((x == pt2.x)&&(y == pt2.y)) return true; else return false; }; }; typedef vector pointSet; struct segment { point pt0; point pt1; double dist; double ang; bool operator<(segment seg2) { if(dist < seg2.dist) return true; else return false; }; }; typedef vector segmentSet; struct object { pointSet points; double perimeter; double area; point center; bool isPattern; bool clockWise; string name; }; typedef vector objectSet; struct RGB { unsigned char r; unsigned char g; unsigned char b; }; void drawPixel(int x, int y, RGB& color, unsigned char* mask, int width, int height); void drawPoint(int x, int y, RGB& color, unsigned char* mask, int width, int height); void drawLine(int x0, int y0, int x1, int y1, RGB& vertColor, RGB& segColor, unsigned char* mask, int width, int height); void drawCycle(pointSet& cycle, RGB& vertColor, RGB& segColor, unsigned char* mask, int width, int height); void drawObjects(objectSet& objects, unsigned char* img, int width, int height); //void traceLines(point origin, point pt, segmentSet& result, double ang_min, double ang_max, unsigned char* mask, int width, int height); //void findSegments(point pt, unsigned char* mask, int width, int height); void vectorizeMask1(unsigned char* img_in, unsigned char* img_out, int width, int height); void vectorizeMask2(unsigned char* img_in, unsigned char* img_aux, objectSet& objects, int width, int height); void getCriticalPoints(objectSet& objects, unsigned char* img, int width, int height); #endif