27 #ifndef SCRIBO_TEXT_CLEAN_INPLACE_HH
28 # define SCRIBO_TEXT_CLEAN_INPLACE_HH
34 # include <mln/core/concept/image.hh>
35 # include <mln/core/concept/weighted_window.hh>
36 # include <mln/core/routine/extend.hh>
38 # include <mln/morpho/skeleton_constrained.hh>
39 # include <mln/morpho/dilation.hh>
41 # include <mln/topo/skeleton/is_simple_point.hh>
42 # include <mln/topo/skeleton/crest.hh>
44 # include <mln/logical/not.hh>
46 # include <mln/debug/filename.hh>
47 # include <mln/io/pbm/save.hh>
49 #include <mln/labeling/wrap.hh>
50 #include <mln/win/octagon2d.hh>
52 #include <mln/arith/revert.hh>
54 #include <mln/transform/distance_front.hh>
57 #include <mln/linear/gaussian.hh>
58 #include <mln/value/int_u8.hh>
60 #include <mln/data/convert.hh>
61 #include <mln/value/rgb8.hh>
62 #include <mln/io/pgm/all.hh>
64 #include <scribo/core/line_info.hh>
65 #include <scribo/upsampling/bs2x.hh>
66 #include <scribo/upsampling/eagle.hh>
67 #include <scribo/subsampling/bilinear.hh>
86 template <
typename L,
typename I>
91 # ifndef MLN_INCLUDE_ONLY
93 template <
typename L,
typename I>
97 mln_trace(
"scribo::text::clean_inplace");
99 I& input =
exact(input_);
100 mlc_bool(mln_site_(I)::dim == 2)::check();
101 mlc_equal(mln_value(I),
bool)::check();
102 mln_precondition(input.is_valid());
103 mln_precondition(line.is_valid());
106 if (line.x_height() < 5)
109 float fact = line.x_height() / 40.0f;
114 input = scribo::upsampling::eagle(input);
118 else if (fact > 2.5f)
120 input = subsampling::bilinear(input,
int(std::ceil(fact - 0.5)));
125 # endif // ! MLN_INCLUDE_ONLY
131 #endif // ! SCRIBO_TEXT_CLEAN_INPLACE_HH