#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!!!!! :) */