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 #include <mln/core/image/image2d.hh>
00027 #include <mln/win/rectangle2d.hh>
00028 #include <mln/core/alias/window2d.hh>
00029
00030 #include <mln/io/pgm/load.hh>
00031 #include <mln/io/pgm/save.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
00041 #include <mln/pw/value.hh>
00042 #include <mln/pw/cst.hh>
00043 #include <mln/fun/ops.hh>
00044
00045 #include "tests/data.hh"
00046
00047
00048 int main()
00049 {
00050 using namespace mln;
00051 using value::int_u8;
00052
00053 win::rectangle2d rec(21, 21);
00054 border::thickness = 66;
00055
00056 image2d<int_u8> lena;
00057 io::pgm::load(lena, MLN_IMG_DIR "/small.pgm");
00058
00059 {
00060 image2d<int_u8> out;
00061 out = morpho::rank_filter(lena, rec, 0);
00062
00063 image2d<int_u8> ref(lena.domain());
00064 ref = morpho::erosion(lena, rec);
00065
00066 mln_assertion(ref == out);
00067 }
00068
00069
00070 {
00071 image2d<int_u8> out;
00072 out = morpho::rank_filter(lena, rec, 21 * 21);
00073
00074 image2d<int_u8> ref(lena.domain());
00075 ref = morpho::dilation(lena, rec);
00076
00077 mln_assertion(ref == out);
00078 }
00079
00080 }