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/world/inter_pixel/dim2/make_edge_image.hh>
00028 #include <mln/value/int_u8.hh>
00029 #include <mln/make/image.hh>
00030 #include <mln/math/abs.hh>
00031 #include <mln/data/compare.hh>
00032
00033
00034 namespace mln
00035 {
00036
00037 struct myfun : Function_vv2v<myfun>
00038 {
00039 typedef mln::value::int_u8 result;
00040
00041 result operator()(const value::int_u8& v1, const value::int_u8& v2) const
00042 {
00043 return math::abs(v1-v2);
00044 }
00045 };
00046
00047 }
00048
00049
00050
00051 int main()
00052 {
00053 using namespace mln;
00054
00055 value::int_u8 vals[][5] = { { 3, 0, 4, 0, 5 },
00056 { 0, 0, 0, 0, 0 },
00057 { 1, 0, 3, 0, 6 },
00058 { 0, 0, 0, 0, 0 },
00059 { 8, 0, 7, 0, 3 } };
00060
00061 value::int_u8 refs[][5] = { { 0, 1, 0, 1, 0 },
00062 { 2, 0, 1, 0, 1 },
00063 { 0, 2, 0, 3, 0 },
00064 { 7, 0, 4, 0, 3 },
00065 { 0, 1, 0, 4, 0 } };
00066
00067 typedef image2d<value::int_u8> ima_t;
00068 ima_t ima = make::image(vals);
00069 ima_t ref = make::image(refs);
00070
00071 ima_t res = world::inter_pixel::dim2::make_edge_image(ima, myfun());
00072
00073 mln_assertion(res == ref);
00074 }