27 #ifndef SCRIBO_PREPROCESSING_DESKEW_CROP_HH
28 # define SCRIBO_PREPROCESSING_DESKEW_CROP_HH
34 # include <scribo/preprocessing/deskew.hh>
39 namespace preprocessing
58 template <
typename I,
typename J>
60 deskew(const Image<I>& crop_gl, const Image<I>& input_gl);
62 # ifndef MLN_INCLUDE_ONLY
146 template <
typename I>
148 deskew(const Image<I>& crop_gl_, const Image<I>& input_gl_)
150 const I& crop_gl =
exact(crop_gl_);
151 const I& input_gl =
exact(input_gl_);
153 mln_trace(
"scribo::preprocessing::deskew_crop");
154 mln_assertion(crop_gl.is_valid());
155 mln_assertion(input_gl.is_valid());
156 mlc_is(mln_domain(I), box2d)::check();
157 mlc_is_not(mln_value(I),
bool)::check();
158 mlc_is_not_a(mln_value(I), value::Vectorial)::check();
160 double angle = internal::perform_deskew(crop_gl);
166 if (angle > 0.5 || angle < -0.5)
167 output = geom::
rotate(crop_gl, - angle,
169 extend(input_gl, mln_max(mln_value(I))),
170 make::box2d(crop_gl.
nrows(),
176 # endif // ! MLN_INCLUDE_ONLY
184 # endif // SCRIBO_PREPROCESSING_DESKEW_CROP_HH