00001
00002
00003
00008 #include <flgrCoreTypes.h>
00009 #include <flgrCoreErrors.h>
00010 #include <flgrCoreData.h>
00011 #include <flgrImageIO.h>
00012 #include <flgrMorphoDistance.h>
00013
00014 #include <time.h>
00015
00016 #define BENCH_FUCTION(nbtime,textinfo,function,...) \
00017 { \
00018 clock_t before, after; \
00019 int i; \
00020 before=clock(); \
00021 for(i=0;i<nbtime;i++) { \
00022 function(__VA_ARGS__); \
00023 } \
00024 after=clock(); \
00025 printf(textinfo " time : %d us \n", \
00026 (int) ((after - before)/(CLOCKS_PER_SEC/1000000)/nbtime)); \
00027 }
00028
00029
00030 int main(void) {
00031 FLGR_Data2D *imin;
00032 FLGR_Data2D *imDest1;
00033 int i;
00034
00035 imin = flgr2d_load_pgm("../../images/bin/shape4.pgm");
00036 imDest1 = flgr2d_create_pixmap_from(imin);
00037
00038 BENCH_FUCTION(1000,"Distance processing",flgr2d_distance,imDest1, imin, FLGR_4_CONNEX);
00039
00040 flgr2d_save_pgm(imDest1,"distance.pgm",5);
00041
00042 flgr2d_destroy(imin);
00043 flgr2d_destroy(imDest1);
00044 }
00045
00046