4518: Fix bug in histo3d_rgb (parameters'order in Point's constructor)

* green/mln/accu/stat/histo3d_rgb.hh (take) : Fix point's call. * green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc (conv) : Delete func. * green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc (mean_histo, var_histo2) : Update func. --- trunk/milena/sandbox/ChangeLog | 11 ++++++++++ .../sandbox/green/mln/accu/stat/histo3d_rgb.hh | 3 +- .../tests/accu/stat/histo3d_rgb/histo3d_rgb.cc | 22 +------------------ 3 files changed, 15 insertions(+), 21 deletions(-) diff --git a/trunk/milena/sandbox/ChangeLog b/trunk/milena/sandbox/ChangeLog index cdf5a60..df395ef 100644 --- a/trunk/milena/sandbox/ChangeLog +++ b/trunk/milena/sandbox/ChangeLog @@ -56,6 +56,17 @@ 2009-09-14 Yann Jacquelet <jacquelet@lrde.epita.fr> + Fix bug in histo3d_rgb (parameters'order in Point's constructor) + + * green/mln/accu/stat/histo3d_rgb.hh + (take) : Fix point's call. + * green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc + (conv) : Delete func. + * green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc + (mean_histo, var_histo2) : Update func. + +2009-09-14 Yann Jacquelet <jacquelet@lrde.epita.fr> + Move stats directory in doc/examples. * green/doc/examples/stats : New directory. diff --git a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_rgb.hh b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_rgb.hh index 8a10c0b..461870a 100644 --- a/trunk/milena/sandbox/green/mln/accu/stat/histo3d_rgb.hh +++ b/trunk/milena/sandbox/green/mln/accu/stat/histo3d_rgb.hh @@ -247,7 +247,8 @@ namespace mln // Just convert a greyscale value (int_u8 like) to a position for an // iterator on the resulting image. - ++count_(point3d(t.red(), t.green(), t.blue())); + // Take care to the constructor : Point(slice, row, column) + ++count_(point3d(t.blue(), t.red(), t.green())); trace::exiting("mln::accu::stat::histo3d_rgb<V>::take"); } diff --git a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc index 114a52d..eb87332 100644 --- a/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc +++ b/trunk/milena/sandbox/green/tests/accu/stat/histo3d_rgb/histo3d_rgb.cc @@ -185,17 +185,6 @@ double count_histo(const mln::image3d<unsigned>& img) return result; } -mln::algebra::vec<3,float> conv(const mln::algebra::vec<3,float>& vec) -{ - mln::algebra::vec<3,float> result; - - result[0] = vec[2]; - result[1] = vec[0]; - result[2] = vec[1]; - - return result; -} - mln::algebra::vec<3,float> mean_histo(const mln::image3d<unsigned>& img) { mln_precondition(img.is_valid()); @@ -208,14 +197,8 @@ mln::algebra::vec<3,float> mean_histo(const mln::image3d<unsigned>& img) for_all(p) { - /* - std::cout << "(1) " << p << std::endl; - std::cout << "(2) " << (vec3f)p << std::endl; - std::cout << "(3) " << conv((vec3f)p) << std::endl; - */ count += img(p); - sum += conv((vec3f)p) * img(p); - // sum += p.to_vec() * img(p); + sum += p.to_vec() * img(p); } result = sum / count; @@ -261,8 +244,7 @@ mln::algebra::mat<3,3,float> var_histo2(const mln::image3d<unsigned>& img) for_all(p) { - // point = p.to_vec() - mean; - point = conv((vec3f)p) - mean; + point = p.to_vec() - mean; result += img(p) * (point * point.t()); } -- 1.5.6.5
participants (1)
-
Yann Jacquelet