00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00018 
00019 
00020 
00021 
00022 
00023 
00024 
00025 
00026 
00027 #include <mln/core/image/image2d.hh>
00028 #include <mln/win/rectangle2d.hh>
00029 #include <mln/core/alias/window2d.hh>
00030 
00031 #include <mln/io/pgm/load.hh>
00032 
00033 #include <mln/value/int_u8.hh>
00034 #include <mln/data/fill.hh>
00035 #include <mln/data/compare.hh>
00036 #include <mln/data/median.hh>
00037 #include <mln/morpho/rank_filter.hh>
00038 #include <mln/morpho/dilation.hh>
00039 
00040 #include <mln/pw/value.hh>
00041 #include <mln/pw/cst.hh>
00042 #include <mln/fun/ops.hh>
00043 
00044 #include "tests/data.hh"
00045 
00046 
00047 int main()
00048 {
00049   using namespace mln;
00050   using value::int_u8;
00051 
00052   win::rectangle2d rec(21, 21);
00053   border::thickness = 66;
00054 
00055   image2d<int_u8> lena;
00056   io::pgm::load(lena, MLN_IMG_DIR "/small.pgm");
00057 
00058   {
00059     image2d<int_u8> out;
00060     out = morpho::rank_filter(lena, rec, 0);
00061 
00062     image2d<int_u8> ref(lena.domain());
00063     ref = morpho::erosion(lena, rec);
00064 
00065     mln_assertion(ref == out);
00066   }
00067 
00068 
00069   {
00070     image2d<int_u8> out;
00071     out = morpho::rank_filter(lena, rec, 21 * 21);
00072 
00073     image2d<int_u8> ref(lena.domain());
00074     ref = morpho::dilation(lena, rec);
00075 
00076     mln_assertion(ref == out);
00077   }
00078 
00079 }