27 #ifndef MLN_TRANSFORM_HOUGH_HH
28 # define MLN_TRANSFORM_HOUGH_HH
35 # include <mln/core/image/image2d.hh>
36 # include <mln/data/fill.hh>
38 # include <mln/geom/nrows.hh>
39 # include <mln/geom/ncols.hh>
40 # include <mln/geom/min_col.hh>
41 # include <mln/geom/min_row.hh>
42 # include <mln/geom/bbox.hh>
44 # include <mln/opt/at.hh>
46 # include <mln/math/sin.hh>
47 # include <mln/math/cos.hh>
48 # include <mln/math/pi.hh>
50 # include <mln/make/box2d.hh>
52 # include <mln/value/int_u8.hh>
78 hough(
const Image<I>& input_);
82 # ifndef MLN_INCLUDE_ONLY
90 double to_radians(
double angle)
100 template <
typename I>
102 hough(
const Image<I>& input_)
104 mln_trace(
"mln::transform::hough");
106 const I& input =
exact(input_);
107 mlc_equal(mln_value(I),
bool)::check();
108 mln_precondition(input.is_valid());
120 image2d<float> accu(360, 2*maxRho);
123 mln_piter(image2d<int>)
p(input.domain());
126 for (
int angle = 0 ; angle < 360 ; ++angle)
129 theta = internal::to_radians(angle),
133 indexAngle = (
int) (angle),
134 indexRho = (
int)(rho + maxRho + 0.5);
136 ++
opt::at(accu, indexAngle, indexRho);
143 # endif // ! MLN_INCLUDE_ONLY
150 #endif // ! MLN_TRANSFORM_HOUGH_HH