//--------------------------------------------------------------------------- #ifndef Unit1H #define Unit1H //--------------------------------------------------------------------------- #include #include #include #include #include #include #include #include #include //--------------------------------------------------------------------------- #include #include /* MACROS */ #define ABS(a) ( (a) >= 0 ? (a) : -(a) ) #define MAX(a,b) ( (a)>(b) ? (a) : (b) ) #define MAX3(a,b,c) ( (a)>MAX(b,c) ? (a) : MAX(b,c) ) #define SQR(a) ( (a)*(a) ) #define TORED(a) ( (a) & 0x000000FF ) #define TOGREEN(a) ( ((a) & 0x0000FF00) >> 8 ) #define TOBLUE(a) ( ((a) & 0x00FF0000) >> 16 ) #define TOCOLOR(r,g,b) ( ((b)<<16) + ((g)<<8) + (r) ) /* METRICS */ int LIdistance(long, long); int L1distance(long, long); int Eucldistance(long, long); /* THE SLICER FUNCTION */ Graphics::TBitmap *slicer(int (*dist)(long, long), AnsiString, double, double); /* Generates the slices of a 24-bit True Color bitmap file. Usage: Parameters: dist : distance function to be used. Implemented distance functions are at the metrics section. filename : name of the file to process. Needed at initialization. TH, VTH : the Threshold and Vertical Threshold to be used. ( they're dependent of the number of slices you'd like to extract... ex.TH=20,VTH=10 or TH=10,VTH=3 or TH=10,VTH=0.5 ) Initialization: give all parameters. It will load the image and return its first slice. Get next slice: call function with empty string as a filename. You may change the distance function used to gain the slice, but if you give NULL, the distance\ function will be the one you used to gain the previous slice. Close usage of function: call function with 0 TH and VTH values. It frees all used static components. You only need to close the function after the last usage. Have a nice day, It's high time for us to get HHHHOOOOOMMMEEEEE!!!!! :) */ struct circle { float x,y; float r; }; class TForm1 : public TForm { __published: // IDE-managed Components TImage *Image1; TOpenPictureDialog *OpenDialog; TMainMenu *MainMenu1; TMenuItem *file1; TMenuItem *Load1; TMenuItem *Save1; TStatusBar *StatusBar1; TSavePictureDialog *SavePictureDialog1; void __fastcall Load1Click(TObject *Sender); void __fastcall FormActivate(TObject *Sender); // void __fastcall Image1MouseMove(TObject *Sender, TShiftState Shift, // int X, int Y); private: TList *obj; Graphics::TBitmap *Bitmap1; int N,M; //dimension of our image void vectorisation(int*); //main functions void vectorisation1(int*); //main functions //******************************************************* //vectors struct vector { int i1,j1,i2,j2; //i1,j1 -down i2,j2-up; } *vec; //typedef *vector Vector; void small_vectors(int*); //connected points to small vectors void large_vectors();//connected small vectors to larger TList* vectors(TList*,int,double); //connected small vectors to larger TList* disband(TList*); TList* disshort(TList*,int); TList *svector_list; //short vector list TList *lvector_list; //large vector list //******************************************************* //points struct point { int i1,j1; }*po; TList *point_list; //alone points list TList *point1_list; //******************************************************* // User declarations //******************************************************* //circle circle * circ; TList *circle_list; //alone points list void Find_circle(TList* ,int*); void ala(int ,int ,int ,int ,int ,int ,circle* ); //******************************************************* //circle struct pie { float x,y; float r; int startx,starty; }*pi; TList *pie_list; //alone points list TList * Find_pie(TList*); int isacircle(struct circle *,int *); //******************************************************* //******************************************************* //line struct line { int x1,y1; int x2,y2; }*lin; TList *line_list; //alone points list TList *line1_list; //alone points list TList *lines(TList*,int); void liness(int*); //******************************************************* //******************************************************* //rectangle struct rectangle { int x1,y1; int x2,y2; int x3,y3; int x4,y4; }*rec; TList *rectangle_list; //alone points list TList *find_form(TList* ) ; //******************************************************* //******************************************************* //triangle struct triangle { int x1,y1; int x2,y2; int x3,y3; }*tri; TList *triangle_list; //alone points list //******************************************************* void sh(); /*TList *obj; int **mask1; int **mask2; int **mask3; int **mask4; int*t1; int*t2; int*t3; int*t4; float *ttx; float *tty; int *tab; int * f(int*,int**); int * f1(int*); int * f2(int*); TList *V(int*,int*); */ public: // User declarations __fastcall TForm1(TComponent* Owner); }; //--------------------------------------------------------------------------- extern PACKAGE TForm1 *Form1; //--------------------------------------------------------------------------- #endif