00001
00002
00003
00008 #include <flgrCoreTypes.h>
00009 #include <flgrCoreErrors.h>
00010 #include <flgrCoreData.h>
00011 #include <flgrCoreIO.h>
00012 #include <flgrCoreSlideWindow.h>
00013 #include <flgrCoreNhbManage.h>
00014 #include <flgrArith.h>
00015 #include <flgrImageIO.h>
00016 #include <flgrMorphoBase.h>
00017
00018
00019
00023 void flgr2d_my_maximum_fgUINT8(FLGR_Vector *result, FLGR_NhbBox2D *extr) {
00024 int i,k;
00025 int spp = extr->spp;
00026 fgUINT8 *presult = (fgUINT8 *) result->array;
00027 fgUINT8 *list_data_val;
00028 int *size = extr->size;
00029 fgUINT8 maxi;
00030
00031 for(k=0 ; k<spp ; k++) {
00032 list_data_val = (fgUINT8 *) extr->list_data_val[k];
00033 maxi = list_data_val[0];
00034 for(i=1 ; i<size[k] ; i++){
00035 maxi = FLGR_MAX(maxi,list_data_val[i]);
00036 }
00037 flgr_set_array_fgUINT8(presult,k,maxi);
00038 }
00039
00040 return;
00041 }
00042
00046 void flgr2d_my_dilate_fgUINT8(FLGR_Data2D *imgdest, FLGR_Data2D *imgsrc, FLGR_Data2D *nhb) {
00047 flgr2d_raster_slide_window(imgdest, imgsrc, nhb, FLGR_NHB_NO_SYM, flgr2d_my_maximum_fgUINT8);
00048 }
00049
00050
00051
00052
00053
00054 int main(void) {
00055 FLGR_Data2D *imin;
00056 FLGR_Data2D *imDest1, *imDest2, *imtmp;
00057 FLGR_Data2D *nhb;
00058 int i;
00059
00060 imin = flgr2d_load_pgm("../../images/gray/lena.pgm");
00061 imDest1 = flgr2d_create_pixmap_from(imin);
00062 nhb = flgr2d_create_neighborhood(13,13,imin->spp,imin->type,FLGR_HEX,FLGR_6_CONNEX);
00063
00064
00065 flgr2d_my_dilate_fgUINT8(imDest1, imin, nhb);
00066
00067 flgr2d_save_pgm(imDest1,"my_dilate_uint8.pgm",5);
00068
00069 flgr2d_destroy(imin);
00070 flgr2d_destroy(imDest1);
00071 flgr2d_destroy(nhb);
00072 }
00073
00074