https://svn.lrde.epita.fr/svn/oln/branches/cleanup-2008/milena/sandbox
Index: ChangeLog
from Ugo Jardonnet <ugo.jardonnet(a)lrde.epita.fr>
INIM: Classif: Update gif creation.
* inim/classif/src/display.hh: Display watershed class.
* inim/classif/src/iccvg04.cc: Modify output info.
* inim/classif/src/proj.hh: Beautify.
* inim/classif/Makefile: Remove warning in non debug.
Makefile | 4 ++--
src/display.hh | 28 +++++++++++++++-------------
src/iccvg04.cc | 7 +++----
src/proj.hh | 3 ++-
4 files changed, 22 insertions(+), 20 deletions(-)
Index: inim/classif/src/display.hh
--- inim/classif/src/display.hh (revision 2835)
+++ inim/classif/src/display.hh (working copy)
@@ -34,6 +34,7 @@
#include <mln/geom/nslis.hh>
#include <mln/value/all.hh>
#include <mln/core/image/image3d.hh>
+#include <mln/literal/colors.hh>
#include <sys/stat.h>
#include <sstream>
@@ -44,29 +45,30 @@
namespace mln
{
- template <typename I>
- void display(const I& ima, const char * dir)
+ template <typename I, typename J, typename K>
+ void display(const I& histo, const J& ws, K mean, const char * dir)
{
mkdir(dir, 0777);
chdir(dir);
- image2d< mln_value(I) > out(geom::nrows(ima), geom::ncols(ima));
+ image2d< value::rgb8 > out(geom::nrows(histo), geom::ncols(histo));
+ level::fill(out, literal::white);
- for (int s = 0; s < geom::nslis(ima); ++s)
+ for (int s = 0; s < geom::nslis(histo); ++s)
{
- // image2d< value::int_u8 > out(geom::nrows(ima), geom::ncols(ima));
- for (int r = 0; r < geom::nrows(ima); ++r)
+ for (int r = 0; r < geom::nrows(histo); ++r)
+ for (int c = 0; c < geom::ncols(histo); ++c)
+ if (histo(point3d(s,r,c)) > 0)
{
- for (int c = 0; c < geom::ncols(ima); ++c)
- {
- out(point2d(r, c)) = ima(point3d(s, r, c));
- }
+ if (ws(point3d(s,r,c)) > 0)
+ out(point2d(r, c)) =
convert::to<value::rgb8>(mean[ws(point3d(s,r,c))]);
+ else
+ out(point2d(r, c)) = literal::red;
}
std::ostringstream is;
- is << "out_" << s << ".pgm";
-
- io::pgm::save(out, is.str());
+ is << "out_00" << s << ".ppm";
+ io::ppm::save(out, is.str());
}
chdir("..");
Index: inim/classif/src/iccvg04.cc
--- inim/classif/src/iccvg04.cc (revision 2835)
+++ inim/classif/src/iccvg04.cc (working copy)
@@ -93,9 +93,7 @@
point3d p3(ima(p).red() / f, ima(p).green() / f, ima(p).blue() / f);
int w = ws(p3);
- //check if we are not on a border of the WS
- if (w == 0)
- border++;
+ //Even if we are not on a border of the WS
count[w] += histo(p3);
sum[w] += histo(p3) * convert::to< algebra::vec<3, value::int_u8> >(p3);
@@ -103,7 +101,7 @@
convert::to<algebra::vec<3, value::int_u8> >(p3) << std::endl;
}
- std::cout << border << std::endl;
+ std::cout << "dyke point : " << count[0] << std::endl;
for (int i = 0; i < nbasins + 1; ++i)
{
std::cout << "sum[" << i << "] = " <<
sum[i] * f << " / " << count[i] << " == ";
@@ -132,6 +130,7 @@
io::ppm::save(out, "out.ppm");
save_class(histo, ws, sum, "palette.ppm");
+ display(histo, ws, sum, "histo");
}
bool usage(int argc, char ** argv)
Index: inim/classif/src/proj.hh
--- inim/classif/src/proj.hh (revision 2835)
+++ inim/classif/src/proj.hh (working copy)
@@ -34,6 +34,7 @@
#include <mln/accu/mean.hh>
#include <mln/accu/maj_h.hh>
#include <mln/literal/white.hh>
+#include <mln/literal/colors.hh>
namespace mln
{
@@ -67,8 +68,8 @@
//std::cout << histo;
image2d<value::rgb8> out(proj_class.domain());
-
level::fill(out, literal::white);
+
mln_piter(image2d<value::int_u8>) p(proj_class.domain());
for_all(p)
if (hproj(p) > 0)
Index: inim/classif/Makefile
--- inim/classif/Makefile (revision 2835)
+++ inim/classif/Makefile (working copy)
@@ -21,14 +21,14 @@
$(ICCVG): $(ICCVG_SRC)
- g++ $(ICCVG_INCLUDES) -Wall -W -O1 -DNDEBUG $(ICCVG_SRC) -o $(ICCVG)
+ g++ $(ICCVG_INCLUDES) -O1 -DNDEBUG $(ICCVG_SRC) -o $(ICCVG)
$(ICCVG_DBG): $(ICCVG_SRC)
g++ $(ICCVG_INCLUDES) -Wall -W -O0 -g3 -ggdb3 $(ICCVG_SRC) -o $(ICCVG_DBG)
$(V2): $(V2_SRC)
- g++ $(V2_INCLUDES) -Wall -W -O1 -DNDEBUG $(V2_SRC) -o $(V2)
+ g++ $(V2_INCLUDES) -O1 -DNDEBUG $(V2_SRC) -o $(V2)
$(V2_DBG): $(V2_SRC) .dep_v2