URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2009-03-23 Fabien Freling <fabien.freling(a)lrde.epita.fr>
Change arguments of projected_histo().
* mln/world/binary_2d/projected_histo.hh: Change arguments, now returns
a couple of image1d.
---
projected_histo.hh | 17 +++++++++++------
1 file changed, 11 insertions(+), 6 deletions(-)
Index: trunk/milena/mln/world/binary_2d/projected_histo.hh
===================================================================
--- trunk/milena/mln/world/binary_2d/projected_histo.hh (revision 3561)
+++ trunk/milena/mln/world/binary_2d/projected_histo.hh (revision 3562)
@@ -36,6 +36,7 @@
# include <mln/core/image/image2d.hh>
# include <mln/core/alias/dpoint2d.hh>
# include <mln/value/int_u12.hh>
+# include <mln/util/couple.hh>
namespace mln
{
@@ -46,15 +47,17 @@
namespace binary_2d
{
- void projected_histo(const image2d<bool>& input,
- image1d<float>& row_histo,
- image1d<float>& col_histo,
- bool value = true)
+ util::couple<image1d<float>, image1d<float> >
+ projected_histo(const image2d<bool>& input, bool value = true)
{
const unsigned nrows = input.nrows();
+ image1d<float> row_histo(nrows);
data::fill(row_histo, 0);
+
const unsigned ncols = input.ncols();
+ image1d<float> col_histo(ncols);
data::fill(col_histo, 0);
+
mln_precondition(row_histo.nelements() == nrows);
mln_precondition(col_histo.nelements() == ncols);
@@ -71,10 +74,12 @@
}
for (unsigned i = 0; i < row_histo.ninds(); ++i)
- row_histo.at_(i) /= ncols;
+ row_histo.at_(i) = row_histo.at_(i) * 100 / ncols;
for (unsigned i = 0; i < col_histo.ninds(); ++i)
- col_histo.at_(i) /= nrows;
+ col_histo.at_(i) = col_histo.at_(i) * 100 / nrows;
+
+ return util::couple<image1d<float>, image1d<float> > (row_histo,
col_histo);
}
} // end of namespace mln::world::binary_2d