* src/util/Makefile.am,
* src/util/component_precise_outline.cc: New.
---
scribo/ChangeLog | 7 ++
scribo/src/{primitive/remove => util}/Makefile.am | 6 +-
.../component_precise_outline.cc} | 61 ++++++++++----------
3 files changed, 41 insertions(+), 33 deletions(-)
copy scribo/src/{primitive/remove => util}/Makefile.am (86%)
copy scribo/src/{debug/show_text_lines_wo_seps.cc =>
util/component_precise_outline.cc} (67%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 3cc2cac..e31876d 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,12 @@
2011-06-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add a new example.
+
+ * src/util/Makefile.am,
+ * src/util/component_precise_outline.cc: New.
+
+2011-06-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add binaries for ICDAR 2011 contests.
* scribo/toolchain/internal/content_in_hdoc_functor.hh: Remove
diff --git a/scribo/src/primitive/remove/Makefile.am b/scribo/src/util/Makefile.am
similarity index 86%
copy from scribo/src/primitive/remove/Makefile.am
copy to scribo/src/util/Makefile.am
index a673886..729a7c0 100644
--- a/scribo/src/primitive/remove/Makefile.am
+++ b/scribo/src/util/Makefile.am
@@ -16,8 +16,8 @@
include $(top_srcdir)/scribo/scribo.mk
+noinst_PROGRAMS = \
+ component_precise_outline
-noinst_PROGRAMS = \
- separators
-separators_SOURCES = separators.cc
+component_precise_outline_SOURCES = component_precise_outline.cc
diff --git a/scribo/src/debug/show_text_lines_wo_seps.cc
b/scribo/src/util/component_precise_outline.cc
similarity index 67%
copy from scribo/src/debug/show_text_lines_wo_seps.cc
copy to scribo/src/util/component_precise_outline.cc
index 98ef05e..09c3f90 100644
--- a/scribo/src/debug/show_text_lines_wo_seps.cc
+++ b/scribo/src/util/component_precise_outline.cc
@@ -23,65 +23,66 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#include <iostream>
-
#include <mln/core/image/image2d.hh>
#include <mln/io/pbm/load.hh>
-#include <mln/value/int_u16.hh>
-#include <mln/draw/box_plain.hh>
-#include <mln/pw/all.hh>
-#include <mln/core/image/dmorph/image_if.hh>
+#include <mln/io/ppm/save.hh>
#include <mln/data/convert.hh>
+#include <mln/value/rgb8.hh>
#include <mln/literal/colors.hh>
+#include <mln/draw/line.hh>
+#include <mln/util/timer.hh>
-#include <scribo/text/recognition.hh>
-
+#include <scribo/util/component_precise_outline.hh>
#include <scribo/debug/usage.hh>
-#include <scribo/core/document.hh>
-#include <scribo/core/component_set.hh>
-#include <scribo/core/object_links.hh>
-#include <scribo/core/object_groups.hh>
-
-#include <scribo/text/extract_lines.hh>
-
-#include <scribo/io/xml/save.hh>
+#include <mln/pw/all.hh>
+#include <mln/core/image/dmorph/image_if.hh>
const char *args_desc[][2] =
{
+ { "input.pbm", "A binary image" },
+ { "output.ppm", "Output image." },
{0, 0}
};
-
-int main(int argc, char* argv[])
+int main(int argc, char *argv[])
{
- using namespace scribo;
using namespace mln;
+ using namespace scribo;
if (argc != 3)
return scribo::debug::usage(argv,
- "Show text lines",
- "input.pbm output.ppm",
+ "Extract component precise outlines",
+ "input.pbm output.pbm",
args_desc);
trace::entering("main");
image2d<bool> input;
- mln::io::pbm::load(input, argv[1]);
+ io::pbm::load(input, argv[1]);
+
+ mln::util::timer t;
+ t.start();
- typedef image2d<scribo::def::lbl_type> L;
- line_set<L> lines = text::extract_lines(input, c8());
+ typedef mln::p_array<mln::point2d> par_t;
+ par_t par = scribo::util::component_precise_outline(input);
- // Color image with line bboxes.
+ t.stop();
+ std::cout << t << std::endl;
+
+ image2d<value::rgb8> input_rgb = data::convert(value::rgb8(), input);
+
+ point2d last_point = par[0];
+ mln_piter_(par_t) p(par);
+ for_all(p)
{
- image2d<value::rgb8> output = data::convert(value::rgb8(), input);
- for_all_lines(l, lines)
- if (lines(l).is_textline())
- mln::draw::box(output, lines(l).bbox(), literal::red);
- mln::io::ppm::save(output, argv[2]);
+ mln::draw::line(input_rgb, last_point, p, literal::red);
+ last_point = p;
}
+ io::ppm::save(input_rgb, argv[2]);
+
trace::exiting("main");
}
--
1.5.6.5