00001
00002
00003
00004
00005
00006
00007
00008 from fulguro import *
00009
00010 imin = flgr2d_load_png("../../images/color/lena.png");
00011 imin2 = flgr2d_load_pgm("../../images/gray/lena.pgm");
00012 imout = FLGR_Data2D(imin)
00013 imout_ref = FLGR_Data2D(imin)
00014 semap8 = FLGR_Data2D(imin2)
00015
00016 semap = FLGR_Data2D(imin.size_y, imin.size_x, 1, FLGR_INT32)
00017 semaptmp = FLGR_Data2D(imin.size_y, imin.size_x, 1, FLGR_INT32)
00018 nhbsemap = FLGR_Data2D(1,FLGR_INT32, FLGR_8_CONNEX)
00019 vecmax = FLGR_Vector(1,FLGR_INT32)
00020 vecmin = FLGR_Vector(1,FLGR_INT32)
00021
00022 flgr2d_copy(semaptmp,imin2)
00023 flgr2d_gradient_thick(semap,semaptmp,nhbsemap)
00024 flgr2d_arith_invert(semap,semap)
00025 flgr2d_histogram_normalize(semap,semap,0,255)
00026 flgr2d_arith_div(semap,semap,32)
00027 flgr2d_copy(semap8,semap)
00028 flgr2d_measure_min_max(semap,vecmin,vecmax)
00029
00030 w = vecmax[0];
00031 w = (w/2)*2+1
00032 nhb_ref = FLGR_Data2D(w, w, imin.spp, imin.type, FLGR_RECT,FLGR_8_CONNEX)
00033
00034 print "Maximum median size :", w
00035
00036
00037 flgr2d_median_resizeable(imout,imin,semap,FLGR_DISC)
00038 flgr2d_median(imout_ref,imin,nhb_ref);
00039
00040 flgr_display(imin,imout_ref,imout,semap8,"in","out_ref","out","map")
00041