https://svn.lrde.epita.fr/svn/oln/trunk/milena/sandbox
Index: ChangeLog
from Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
New shell script dedicated to fast word segmentation.
* icdar/2009/hsc/first_attempts/words_25p.sh: New.
This version works on images reduced by 25%.
* icdar/2009/hsc/ws_to_wsl.hh: Add log.
first_attempts/words_25p.sh | 11 +++++++++++
ws_to_wsl.hh | 21 +++++++++++++++++++++
2 files changed, 32 insertions(+)
Index: icdar/2009/hsc/first_attempts/words_25p.sh
--- icdar/2009/hsc/first_attempts/words_25p.sh (revision 0)
+++ icdar/2009/hsc/first_attempts/words_25p.sh (revision 0)
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+bin_rep='/home/theo/lrde/olena/trunk/milena/sandbox/theo/+bin'
+
+convert -geometry 25% +compress -depth 8 $1 tmp_small.pgm
+convert -negate -geometry 25% +compress $1 tmp_small.pbm
+$bin_rep/closing_rectangle tmp_small.pbm 1 7 tmp_small_clo.pbm
+$bin_rep/distance_thick tmp_small_clo.pbm tmp_dist.pgm
+$bin_rep/closing_area tmp_dist.pgm 125 tmp_clo.pgm
+$bin_rep/watershed_flooding tmp_clo.pgm tmp_ws.pgm
+$bin_rep/watershed_superpose tmp_small.pgm tmp_ws.pgm tmp_out.ppm
Property changes on: icdar/2009/hsc/first_attempts/words_25p.sh
___________________________________________________________________
Added: svn:executable
+ *
Index: icdar/2009/hsc/ws_to_wsl.hh
--- icdar/2009/hsc/ws_to_wsl.hh (revision 3723)
+++ icdar/2009/hsc/ws_to_wsl.hh (working copy)
@@ -18,6 +18,8 @@
#include <mln/algebra/mat.hh>
#include <mln/make/region_adjacency_graph.hh>
+#include <mln/make/p_vertices_with_mass_centers.hh>
+#include <mln/debug/draw_graph.hh>
#include <mln/core/site_set/p_edges.hh>
#include <mln/core/site_set/p_vertices.hh>
@@ -301,6 +303,25 @@
}
+#ifdef LOG
+ {
+ image2d<value::rgb8> cool(small.domain());
+ data::fill(cool, literal::white);
+ data::fill((cool | (pw::value(ws) == pw::cst(0))).rw(),
+ literal::red);
+
+ typedef p_vertices< G, fun::i2v::array<point2d> > pv_t;
+ pv_t pv = make::p_vertices_with_mass_centers(ws, n_basins, gr);
+
+ debug::draw_graph(cool, pv,
+ literal::green,
+ literal::black);
+
+ io::ppm::save(cool, "temp_cool.ppm");
+ }
+#endif // LOG
+
+
util::array<unsigned>
v_left (n_basins + 1),
v_right(n_basins + 1);