00001 #include <mln/core/image/image2d.hh>
00002 #include <mln/core/image/dmorph/extended.hh>
00003 #include <mln/core/var.hh>
00004 #include <mln/core/routine/extend.hh>
00005
00006 #include <mln/value/rgb8.hh>
00007
00008 #include <mln/border/fill.hh>
00009
00010 #include <mln/literal/colors.hh>
00011
00012 #include <mln/data/fill.hh>
00013
00014 #include <mln/draw/box.hh>
00015
00016 #include <mln/fun/x2x/rotation.hh>
00017
00018 #include <mln/algebra/vec.hh>
00019
00020 #include <doc/tools/sample_utils.hh>
00021
00022 int main()
00023 {
00024 using namespace mln;
00025
00026 const char *IMA1_PPM = "ima2d-rot";
00027 const char *IMA2_PPM = "ima2d-rot";
00028
00029
00030 border::thickness = 30;
00031
00032
00033 image2d<value::rgb8> ima1_(220, 220);
00034 data::fill(ima1_, literal::cyan);
00035 border::fill(ima1_, literal::yellow);
00036
00037 mln_VAR(ima1, extend(ima1_, pw::cst(literal::yellow)));
00038
00039
00040 image2d<value::rgb8> ima2(220, 220);
00041 data::fill(ima2, literal::cyan);
00042 border::fill(ima2, literal::yellow);
00043
00044 box2d extended_domain= ima1.domain();
00045 extended_domain.enlarge(border::thickness);
00046
00047
00048 draw::box(ima1, geom::bbox(ima1_), literal::red);
00049
00050 doc::ppmsave(ima1 | extended_domain, IMA1_PPM);
00051
00052
00053 fun::x2x::rotation<2,float> rot1(0.5, literal::zero);
00054 image2d<value::rgb8>::fwd_piter p(ima1.domain());
00055 for_all(p)
00056 {
00057 algebra::vec<2,float> pv = p.to_site().to_vec();
00058 algebra::vec<2,float> v = rot1.inv()(pv);
00059 ima2(p) = ima1(v);
00060 }
00061
00062 draw::box(ima2, ima2.bbox(), literal::red);
00063 doc::ppmsave(extended_to(ima2, extended_domain), IMA2_PPM);
00064
00065
00066 }