Fulguro Logo Support This Project

example3.c

Morphological Distance Fucntion

/***********************************************************************
 * Fulguro Example 3 : distance function
 ***********************************************************************/
#include <flgrCoreTypes.h>
#include <flgrCoreErrors.h>
#include <flgrCoreData.h>
#include <flgrImageIO.h>
#include <flgrMorphoDistance.h>

#include <time.h>

#define BENCH_FUCTION(nbtime,textinfo,function,...)         \
  {                                 \
    clock_t before, after;                      \
    int i;                              \
    before=clock();                         \
    for(i=0;i<nbtime;i++) {                     \
      function(__VA_ARGS__);                        \
    }                                   \
    after=clock();                          \
    printf(textinfo " time : %d us \n",                 \
       (int) ((after - before)/(CLOCKS_PER_SEC/1000000)/nbtime));   \
  }


int main(void) {
  FLGR_Data2D *imin;
  FLGR_Data2D *imDest1;
  int i;

  imin    = flgr2d_load_pgm("../../images/bin/shape4.pgm");
  imDest1 = flgr2d_create_pixmap_from(imin);
  
  BENCH_FUCTION(1000,"Distance processing",flgr2d_distance,imDest1, imin, FLGR_4_CONNEX);

  flgr2d_save_pgm(imDest1,"distance.pgm",5);

  flgr2d_destroy(imin);
  flgr2d_destroy(imDest1);
}



SourceForge.net Logo
Generated on Tue Nov 11 19:17:22 2008 for Fulguro by doxygen 1.5.6