Commit 5ea13e37 authored by Roland Levillain's avatar Roland Levillain
Browse files

Remove trash/ directories.

	* doc/examples/trash/accu.cc,
	* doc/examples/trash/box.cc,
	* doc/examples/trash/cpp_issue.cc,
	* doc/examples/trash/erosion.cc,
	* doc/examples/trash/for_Z.cc,
	* doc/examples/trash/graph.cc,
	* doc/examples/trash/image2d.cc,
	* doc/examples/trash/image_flat.cc,
	* doc/examples/trash/image_if.cc,
	* doc/examples/trash/image_plain.cc,
	* doc/examples/trash/image_safe.cc,
	* doc/examples/trash/labeling_algo.cc,
	* doc/examples/trash/mk_graph.cc,
	* doc/examples/trash/p_array.2.cc,
	* doc/examples/trash/p_array.cc,
	* doc/examples/trash/p_image.cc,
	* doc/examples/trash/p_key.2.cc,
	* doc/examples/trash/p_key.cc,
	* doc/examples/trash/p_line2d.cc,
	* doc/examples/trash/p_mutable_array_of.cc,
	* doc/examples/trash/p_queue.cc,
	* doc/examples/trash/p_run.cc,
	* doc/examples/trash/p_vaccess.cc,
	* doc/examples/trash/proxy.cc,
	* doc/examples/trash/sub_image.cc,
	* doc/examples/trash/sub_image_if.cc,
	* doc/examples/trash/tuto_bis.cc,
	* doc/examples/trash/tuto_one.cc,
	* doc/examples/trash/vec.cc,
	* doc/examples/trash/win_multiple.cc,
	* doc/examples/trash/window.cc,
	* trash/bgraph_image.cc,
	* trash/bgraph_image.hh,
	* trash/bgraph_psite.hh,
	* trash/boost_graph.cc,
	* trash/boost_graph.hh,
	* trash/boost_graph_access.hh,
	* trash/boost_graph_property.hh,
	* trash/boost_graph_structure.hh,
	* trash/clock_neighb.hh,
	* trash/clock_neighb2d.cc,
	* trash/clock_neighb2d.hh,
	* trash/clock_neighb2d_bis.cc,
	* trash/display_color_pretty.cc,
	* trash/display_color_pretty.hh,
	* trash/display_remove.hh,
	* trash/display_save.hh,
	* trash/display_save_and_show.hh,
	* trash/display_show.cc,
	* trash/display_show.hh,
	* trash/fi_adaptor.cc,
	* trash/fi_adaptor.hh,
	* trash/freeimageplus.mk,
	* trash/graph_image.hh,
	* trash/line_graph_image.hh,
	* trash/mono_obased_rle_encode.hh,
	* trash/mono_obased_rle_image.cc,
	* trash/mono_obased_rle_image.hh,
	* trash/mono_rle_encode.hh,
	* trash/mono_rle_image.cc,
	* trash/mono_rle_image.hh,
	* trash/neighb_get.hh,
	* trash/neighb_image.cc,
	* trash/neighb_image.hh,
	* trash/obased_rle_encode.hh,
	* trash/obased_rle_image.cc,
	* trash/obased_rle_image.hh,
	* trash/p_bgraph.cc,
	* trash/p_bgraph.hh,
	* trash/p_bgraph_piter.hh,
	* trash/rle_encode.hh,
	* trash/rle_image.cc,
	* trash/rle_image.hh,
	* trash/save_and_show.cc,
	* trash/sparse_encode.hh,
	* trash/sparse_image.cc,
	* trash/sparse_image.hh,
	* trash/t_image.cc,
	* trash/t_image.hh,
	* trash/to_tiles.cc,
	* trash/to_tiles.hh,
	* trash/translate_image.cc,
	* trash/translate_image.hh,
	* trash/value_enc_image.cc,
	* trash/value_enc_image.hh,
	* trash/value_encode.hh:
	Remove.
	Addresses Trac ticket #280.
parent f13d23b0
2014-06-20 Roland Levillain <roland@lrde.epita.fr>
Remove trash/ directories.
* doc/examples/trash/accu.cc,
* doc/examples/trash/box.cc,
* doc/examples/trash/cpp_issue.cc,
* doc/examples/trash/erosion.cc,
* doc/examples/trash/for_Z.cc,
* doc/examples/trash/graph.cc,
* doc/examples/trash/image2d.cc,
* doc/examples/trash/image_flat.cc,
* doc/examples/trash/image_if.cc,
* doc/examples/trash/image_plain.cc,
* doc/examples/trash/image_safe.cc,
* doc/examples/trash/labeling_algo.cc,
* doc/examples/trash/mk_graph.cc,
* doc/examples/trash/p_array.2.cc,
* doc/examples/trash/p_array.cc,
* doc/examples/trash/p_image.cc,
* doc/examples/trash/p_key.2.cc,
* doc/examples/trash/p_key.cc,
* doc/examples/trash/p_line2d.cc,
* doc/examples/trash/p_mutable_array_of.cc,
* doc/examples/trash/p_queue.cc,
* doc/examples/trash/p_run.cc,
* doc/examples/trash/p_vaccess.cc,
* doc/examples/trash/proxy.cc,
* doc/examples/trash/sub_image.cc,
* doc/examples/trash/sub_image_if.cc,
* doc/examples/trash/tuto_bis.cc,
* doc/examples/trash/tuto_one.cc,
* doc/examples/trash/vec.cc,
* doc/examples/trash/win_multiple.cc,
* doc/examples/trash/window.cc,
* trash/bgraph_image.cc,
* trash/bgraph_image.hh,
* trash/bgraph_psite.hh,
* trash/boost_graph.cc,
* trash/boost_graph.hh,
* trash/boost_graph_access.hh,
* trash/boost_graph_property.hh,
* trash/boost_graph_structure.hh,
* trash/clock_neighb.hh,
* trash/clock_neighb2d.cc,
* trash/clock_neighb2d.hh,
* trash/clock_neighb2d_bis.cc,
* trash/display_color_pretty.cc,
* trash/display_color_pretty.hh,
* trash/display_remove.hh,
* trash/display_save.hh,
* trash/display_save_and_show.hh,
* trash/display_show.cc,
* trash/display_show.hh,
* trash/fi_adaptor.cc,
* trash/fi_adaptor.hh,
* trash/freeimageplus.mk,
* trash/graph_image.hh,
* trash/line_graph_image.hh,
* trash/mono_obased_rle_encode.hh,
* trash/mono_obased_rle_image.cc,
* trash/mono_obased_rle_image.hh,
* trash/mono_rle_encode.hh,
* trash/mono_rle_image.cc,
* trash/mono_rle_image.hh,
* trash/neighb_get.hh,
* trash/neighb_image.cc,
* trash/neighb_image.hh,
* trash/obased_rle_encode.hh,
* trash/obased_rle_image.cc,
* trash/obased_rle_image.hh,
* trash/p_bgraph.cc,
* trash/p_bgraph.hh,
* trash/p_bgraph_piter.hh,
* trash/rle_encode.hh,
* trash/rle_image.cc,
* trash/rle_image.hh,
* trash/save_and_show.cc,
* trash/sparse_encode.hh,
* trash/sparse_image.cc,
* trash/sparse_image.hh,
* trash/t_image.cc,
* trash/t_image.hh,
* trash/to_tiles.cc,
* trash/to_tiles.hh,
* trash/translate_image.cc,
* trash/translate_image.hh,
* trash/value_enc_image.cc,
* trash/value_enc_image.hh,
* trash/value_encode.hh:
Remove.
Addresses Trac ticket #280.
2014-06-19 Roland Levillain <roland@lrde.epita.fr>
 
Re-enable Milena test world/inter_pixel/display_edge.
# include <mln/accu/stat/mean.hh>
int main()
{
using namespace mln;
mlc_bool(accu::stat::mean<int>::proxy_level == 1)::check();
accu::stat::mean<int> m;
m.take(100);
m.take(2);
mln_assertion(m == 51);
// Just for fun:
mln_assertion(literal::zero != m);
mln_assertion(m != literal::zero);
std::cout << (-m) << std::endl;
}
# include <mln/core/image/image2d.hh>
# include <mln/debug/println.hh>
# include <mln/data/fill.hh>
template <typename B>
void picture(const B& b)
{
using namespace mln;
image2d<char> ima(5, 5);
data::fill(ima, '-');
unsigned i = 0;
mln_piter(B) p(b);
for_all(p)
ima(p) = '0' + i++;
debug::println(ima);
}
int main()
{
using namespace mln;
{
box2d b = make::box2d(2, 3);
picture(b);
}
{
box2d b = make::box2d(1,1, 3,2);
picture(b);
}
}
template <typename E>
struct base
{
typedef const E& box;
typedef const E& box_;
box bbox() const { return *(E*)(void*)(this); }
};
struct box : base<box>
{
box() {}
};
template <typename S>
void foo(const S&)
{
typename S::box b;
// void* v = b;
typename S::box_ b_;
}
int main()
{
box b;
foo(b);
}
// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, version 2 of the License.
//
// Olena is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to produce
// an executable, this file does not by itself cause the resulting
// executable to be covered by the GNU General Public License. This
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
/// \file doc/examples/erosion.cc
///
/// Test on mln::morpho::hit_or_miss.
# include <mln/core/image/image2d.hh>
# include <mln/core/image/image_if.hh>
# include <mln/core/image/sub_image.hh>
# include <mln/core/alias/neighb2d.hh>
# include <mln/core/var.hh>
# include <mln/core/site_set/p_vaccess.hh>
# include <mln/binarization/threshold.hh>
# include <mln/morpho/hit_or_miss.hh>
# include <mln/border/fill.hh>
# include <mln/io/pbm/load.hh>
# include <mln/io/pgm/load.hh>
# include <mln/io/pbm/save.hh>
# include <mln/io/pgm/save.hh>
# include <mln/debug/println.hh>
# include <mln/morpho/opening.hh>
# include <mln/trait/value_.hh>
# include <mln/value/int_u8.hh>
# include <mln/data/paste.hh>
# include <mln/labeling/blobs.hh>
# include <mln/pw/all.hh>
# include <mln/convert/to_fun.hh>
# include <mln/geom/bbox.hh>
void clean_lines(mln::image2d<bool>& in,
const mln::image2d<bool>& ima,
unsigned bbox_larger)
{
using namespace mln;
using value::label_8;
label_8 nlabels;
image2d<label_8> lbl = labeling::blobs(ima, c4(), nlabels);
for (unsigned i = nlabels; i > 0; --i)
{
data::paste(pw::cst(false)
| geom::bbox(lbl | (pw::value(lbl) == pw::cst(i))),//.to_larger(bbox_larger),
in);
}
}
int main(int argc, char*argv[])
{
using namespace mln;
using value::int_u8;
if (argc < 2)
{
std::cout << argv[0] << " <image.pgm> <height> <width>" << std::endl;
return 1;
}
image2d<bool> in;
io::pbm::load(in, argv[1]);
unsigned h = atoi(argv[2]);
unsigned w = atoi(argv[3]);
unsigned n = atoi(argv[4]);
// Remove vertical lines.
win::rectangle2d vwin(h, w);
image2d<bool> vout = morpho::opening(in, vwin);
io::pbm::save(vout, "./vout.pbm");
clean_lines(in, vout, n);
// Remove Horizontal lines.
win::rectangle2d hwin(w, h);
image2d<bool> hout = morpho::opening(in, hwin);
io::pbm::save(hout, "./hout.pbm");
clean_lines(in, hout, n);
io::pbm::save(in, "./out.pbm");
}
# include <mln/core/image/image2d.hh>
# include <mln/core/image/image_if.hh>
# include <mln/core/image/sub_image.hh>
# include <mln/core/site_set/p_vaccess.hh>
# include <mln/convert/from_to.hh>
# include <mln/core/alias/p_runs2d.hh>
# include <mln/core/alias/neighb2d.hh>
# include <mln/core/var.hh>
# include <mln/value/int_u8.hh>
# include <mln/value/rgb8.hh>
# include <mln/literal/colors.hh>
# include <mln/pw/all.hh>
# include <mln/convert/to_fun.hh>
# include <mln/debug/println.hh>
# include <mln/labeling/blobs.hh>
# include <mln/data/fill.hh>
# include <mln/geom/bbox.hh>
namespace mln
{
namespace trait
{
// template <template <class, class> class Op,
// typename F, typename S>
// struct set_binary_< Op, mln::Function_v2v, F, mln::value::Scalar, S >
// {
// typedef Op< F, pw::cst_<mln_value_equiv(S)> > Op_;
// typedef typename Op_::ret ret;
// };
template <template <class, class> class Op,
typename F,
typename R, typename A>
struct set_precise_binary_< Op, F, R (*)(A) >
{
typedef Op< F, fun::C<R (*)(A)> > Op_;
typedef typename Op_::ret ret;
};
template <typename F, typename S>
struct set_binary_< op::eq, mln::Function_v2v, F, mln::value::Scalar, S >
{
typedef mln_trait_op_eq(F, pw::cst_<mln_value_equiv(S)>) ret;
};
// const Image | Function_v2v
// template <typename I, typename F>
// struct set_binary_< op::lor, mln::Image, /* FIXME: const */ I, mln::Function_v2v, F >
// {
// typedef image_if<const I, F> ret;
// };
} // end of namespace mln::trait
template <typename F, typename S>
mln_trait_op_eq(F,S)
operator == (const Function_v2v<F>& fun, const value::Scalar<S>& s)
{
return exact(fun) == pw::cst( value::equiv(s) );
}
template <typename I, typename R, typename A>
image_if< const I, fun::C<R(*)(A)> >
operator | (const Image<I>& ima, R (*f)(A) )
{
return exact(ima) | convert::to_fun(f);
}
// template <typename O, typename R, typename A>
// mln_trait_op_lor(const O, fun::C<R(*)(A)>)
// operator | (const Object<O>& lhs, R (*rhs)(A) )
// {
// return exact(lhs) | convert::to_fun(rhs);
// }
} // end of namespace mln
bool row_oddity(mln::point2d p)
{
return p.row() % 2;
}
namespace my
{
template <typename I>
void fill(I& ima, mln_value(I) v)
{
mln_piter(I) p(ima.domain());
for_all(p)
ima(p) = v;
}
template <typename I, typename J>
void paste(const I& data, J& dest)
{
mln_piter(I) p(data.domain());
for_all(p)
dest(p) = data(p);
}
} // end of namespace my
int main()
{
using namespace mln;
using value::int_u8;
using value::rgb8;
bool vals[6][5] = {
{0, 1, 1, 0, 0},
{0, 1, 1, 0, 0},
{0, 0, 0, 0, 0},
{1, 1, 0, 1, 0},
{1, 0, 1, 1, 1},
{1, 0, 0, 0, 0}
};
image2d<bool> ima = make::image(vals);
debug::println(ima);
int_u8 nlabels;
image2d<int_u8> lab = labeling::blobs(ima, c4(), nlabels);
debug::println(lab);
mln_VAR(lab_0, lab | (pw::value(lab) != 0u));
debug::println(lab_0);
// box2d b3 = geom::bbox(lab | (pw::value(lab) == 3u));
// std::cout << b3 << std::endl
// << std::endl;
// // mln_VAR(lab3, lab | b3);
// // debug::println(lab3);
// // std::cout << lab3.domain() << std::endl
// // << std::endl;
// {
// std::cout << "(ima | sub_D) | pred" << std::endl << std::endl;
// mln_VAR(pred, pw::value(lab) == 3u);
// std::cout << (lab | b3).domain() << std::endl;
// debug::println(lab | b3);
// std::cout << ((lab | b3) | pred).domain() << std::endl;
// debug::println((lab | b3) | pred);
// }
// // il existe une difference entre:
// //
// // - ima | sub_D ou le sub_D DOIT etre inclus dans ima.domain
// // et
// // - ima / sub_D qui reste a ecrire...
// // ou dans ce cas, on aurait (ima / sub_D).domain() == sub_D | f:p->b = ima.domain().has(p)
// {
// std::cout << "(ima | pred) | sub_D" << std::endl << std::endl;
// mln_VAR(pred, pw::value(lab) == 3u);
// // OK :-)
// std::cout << (lab | pred).domain() << std::endl;
// debug::println(lab | pred);
// // KO :-)
// // Cf. commentaire plus haut
// // ici l'erreur est que b3 n'est pas un sous-domaine de celui de "lab | pred"...
// /*
// std::cout << ((lab | pred) | b3).domain() << std::endl;
// debug::println((lab | pred) | b3);
// */
// }
// debug::println(lab | row_oddity);
// my::fill(lab_0, 9);
// debug::println(lab_0);
// debug::println(lab);
// image2d<rgb8> cool(ima.domain());
// data::fill(cool, literal::black);
// data::fill( (cool | (pw::value(lab) == 1u)).rw(),
// literal::red );
// debug::println(cool);
{
p_vaccess< int_u8, p_runs2d > s;
convert::from_to(lab_0, s);
std::cout << s << std::endl;
std::cout << s(3) << std::endl;
std::cout << s(3).bbox() << std::endl;
}
}
// Copyright (C) 2008 EPITA Research and Development Laboratory (LRDE)
//
// This file is part of Olena.
//
// Olena is free software: you can redistribute it and/or modify it under
// the terms of the GNU General Public License as published by the Free
// Software Foundation, version 2 of the License.
//
// Olena is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with Olena. If not, see <http://www.gnu.org/licenses/>.
//
// As a special exception, you may use this file as part of a free
// software project without restriction. Specifically, if other files
// instantiate templates or use macros or inline functions from this
// file, or you compile this file and link it with other files to produce
// an executable, this file does not by itself cause the resulting
// executable to be covered by the GNU General Public License. This
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
# include <cmath>
#include <mln/essential/2d.hh>
#include <mln/transform/influence_zone_geodesic.hh>
#include <mln/make/graph.hh>
#include <mln/util/graph.hh>
#include <mln/util/line_graph.hh>
#include <mln/debug/draw_graph.hh>
#include <mln/debug/colorize.hh>
template <typename P>
struct lg_vertex_values : public mln::Function_v2v< lg_vertex_values<P> >
{
typedef float result;
float operator()(const P& p) const
{
mln::algebra::vec<2,float> v;
v[0] = 0;
v[1] = 1;
float norm = mln::math::sqrt(std::pow(p.to_vec()[0], 2)
+ std::pow(p.to_vec()[1], 2));
// FIXME: missing proxy_impl for point and line2d?
float res = (v * p.to_vec()) / norm;
return res;
}
};
int main(int argc, char *argv[])
{
using namespace mln;
using value::label_16;
using value::rgb8;
if (argc < 2)
{
std::cout << "Usage: " << argv[0] << " <image> <max cosinus>" << std::endl;
return 1;
}
float max_cos = atof(argv[2]);
image2d<bool> ima;
io::pbm::load(ima, argv[1]);
logical::not_inplace(ima);
label_16 nlabels;
image2d<label_16> lbl = labeling::blobs(ima, c8(), nlabels);
#ifndef NOUT
io::ppm::save(debug::colorize(rgb8(), lbl, nlabels), "01-lbl.ppm");
#endif
image2d<label_16> iz = transform::influence_zone_geodesic(lbl, c8(), mln_max(int));
#ifndef NOUT
io::ppm::save(debug::colorize(rgb8(), iz, nlabels), "02-iz.ppm");
#endif
typedef util::graph G;
G g = make::graph(iz | (pw::value(iz) != pw::cst(0u)), nlabels);
// Compute the component centers and use them as vertex.
//FIXME: Add fun::vertex2p
typedef fun::i2v::array<point2d> fv2p_t;
util::array<point2d> centers = labeling::compute(accu::center<point2d>(), iz, nlabels);
fv2p_t fv2p = convert::to<fv2p_t>(centers);
// Create a p_vertices.
p_vertices<G, fv2p_t> pv(g, fv2p);
#ifndef NOUT
image2d<rgb8> gima = data::convert(rgb8(), ima);
debug::draw_graph(gima,
pv,
pw::cst(<