* src/extract/primitive/Makefile.am,
* src/preprocessing/Makefile.am: Add new examples as target.
* src/extract/primitive/find_pattern_lines.cc,
* src/preprocessing/split_bg_fg.cc: New examples.
---
scribo/ChangeLog | 10 +++
scribo/src/extract/primitive/Makefile.am | 2 +
scribo/src/extract/primitive/find_pattern_lines.cc | 75 ++++++++++++++++++++
scribo/src/preprocessing/Makefile.am | 4 +-
scribo/src/preprocessing/split_bg_fg.cc | 67 +++++++++++++++++
5 files changed, 157 insertions(+), 1 deletions(-)
create mode 100644 scribo/src/extract/primitive/find_pattern_lines.cc
create mode 100644 scribo/src/preprocessing/split_bg_fg.cc
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index fd7af50..c4e7c1f 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,15 @@
2009-09-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+ Add new examples in Scribo.
+
+ * src/extract/primitive/Makefile.am,
+ * src/preprocessing/Makefile.am: Add new examples as target.
+
+ * src/extract/primitive/find_pattern_lines.cc,
+ * src/preprocessing/split_bg_fg.cc: New examples.
+
+2009-09-25 Guillaume Lazzara <lazzara(a)lrde.epita.fr>
+
Add new filters in Scribo.
* filter/object_groups_size_ratio.hh,
diff --git a/scribo/src/extract/primitive/Makefile.am
b/scribo/src/extract/primitive/Makefile.am
index 51850f6..c4ebeaf 100644
--- a/scribo/src/extract/primitive/Makefile.am
+++ b/scribo/src/extract/primitive/Makefile.am
@@ -27,6 +27,7 @@ bin_PROGRAMS = \
extract_thick_vlines \
extract_thick_hlines \
find_discontinued_lines \
+ find_pattern_lines \
find_single_lines \
find_thick_lines \
find_thick_and_single_lines
@@ -37,6 +38,7 @@ extract_discontinued_hlines_SOURCES = extract_discontinued_hlines.cc
extract_thick_vlines_SOURCES = extract_thick_vlines.cc
extract_thick_hlines_SOURCES = extract_thick_hlines.cc
find_discontinued_lines_SOURCES = find_discontinued_lines.cc
+find_pattern_lines_SOURCES = find_pattern_lines.cc
find_single_lines_SOURCES = find_single_lines.cc
find_thick_lines_SOURCES = find_thick_lines.cc
find_thick_and_single_lines_SOURCES = find_thick_and_single_lines.cc
diff --git a/scribo/src/extract/primitive/find_pattern_lines.cc
b/scribo/src/extract/primitive/find_pattern_lines.cc
new file mode 100644
index 0000000..eaf2d59
--- /dev/null
+++ b/scribo/src/extract/primitive/find_pattern_lines.cc
@@ -0,0 +1,75 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/value/label_16.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/core/alias/neighb2d.hh>
+#include <mln/io/pbm/all.hh>
+#include <mln/io/ppm/save.hh>
+#include <mln/data/convert.hh>
+#include <mln/debug/superpose.hh>
+
+#include <scribo/debug/usage.hh>
+
+#include <scribo/core/object_image.hh>
+#include <scribo/primitive/extract/lines_h_pattern.hh>
+#include <scribo/primitive/extract/lines_v_pattern.hh>
+
+const char *args_desc[][2] =
+{
+ { "input.pbm", "A binary image." },
+ { "length", " Minimum line length." },
+ {0, 0}
+};
+
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+
+ if (argc != 4)
+ return scribo::debug::usage(argv,
+ "Extract discontinued horizontal and vertical lines",
+ "input.pbm length output.ppm",
+ args_desc,
+ "A color image. Horizontal lines are in red and vertical lines in
green.");
+
+ trace::entering("main");
+
+ typedef image2d<bool> I;
+ I input;
+ io::pbm::load(input, argv[1]);
+
+ I hlines = scribo::primitive::extract::lines_h_pattern(input, atoi(argv[2]));
+ I vlines = scribo::primitive::extract::lines_v_pattern(input, atoi(argv[2]));
+
+ image2d<value::rgb8> out = debug::superpose(input, hlines, literal::red);
+ out = debug::superpose(out, vlines, literal::green);
+
+ io::ppm::save(out, argv[3]);
+
+ trace::exiting("main");
+}
diff --git a/scribo/src/preprocessing/Makefile.am b/scribo/src/preprocessing/Makefile.am
index f6d877c..af6db48 100644
--- a/scribo/src/preprocessing/Makefile.am
+++ b/scribo/src/preprocessing/Makefile.am
@@ -20,6 +20,8 @@
include $(top_srcdir)/scribo/scribo.mk
bin_PROGRAMS = \
+ split_bg_fg \
unskew
-unskew_SOURCES = unskew.cc
+split_bg_fg_SOURCES = split_bg_fg.cc
+unskew_SOURCES = unskew.cc
diff --git a/scribo/src/preprocessing/split_bg_fg.cc
b/scribo/src/preprocessing/split_bg_fg.cc
new file mode 100644
index 0000000..a1aab52
--- /dev/null
+++ b/scribo/src/preprocessing/split_bg_fg.cc
@@ -0,0 +1,67 @@
+// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
+//
+// This file is part of Olena.
+//
+// Olena is free software: you can redistribute it and/or modify it under
+// the terms of the GNU General Public License as published by the Free
+// Software Foundation, version 2 of the License.
+//
+// Olena is distributed in the hope that it will be useful,
+// but WITHOUT ANY WARRANTY; without even the implied warranty of
+// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+// General Public License for more details.
+//
+// You should have received a copy of the GNU General Public License
+// along with Olena. If not, see <http://www.gnu.org/licenses/>.
+//
+// As a special exception, you may use this file as part of a free
+// software project without restriction. Specifically, if other files
+// instantiate templates or use macros or inline functions from this
+// file, or you compile this file and link it with other files to produce
+// an executable, this file does not by itself cause the resulting
+// executable to be covered by the GNU General Public License. This
+// exception does not however invalidate any other reasons why the
+// executable file might be covered by the GNU General Public License.
+
+#include <mln/core/image/image2d.hh>
+#include <mln/io/ppm/all.hh>
+
+#include <scribo/preprocessing/split_bg_fg.hh>
+#include <scribo/debug/usage.hh>
+
+
+const char *args_desc[][2] =
+{
+ { "input.pbm", "A color image." },
+ { "lambda", "Lambda value. (FIX Description)" },
+ { "delta", "Delta value. (FIX Description)" },
+ { "bg.ppm", "The background image (2nd output)." },
+ {0, 0}
+};
+
+
+
+int main(int argc, char *argv[])
+{
+ mln::trace::entering("main");
+ using namespace mln;
+
+ if (argc != 6)
+ return scribo::debug::usage(argv,
+ "Split background and foreground.",
+ "input.pbm bg.ppm fg.ppm",
+ args_desc, "The foreground image.");
+
+ typedef image2d<value::rgb8> I;
+ I input;
+ io::ppm::load(input, argv[1]);
+
+ util::couple<I,I>
+ bg_fg = scribo::preprocessing::split_bg_fg(input,
+ atoi(argv[2]),
+ atoi(argv[3]));
+ io::ppm::save(bg_fg.first(), argv[4]);
+ io::ppm::save(bg_fg.second(), argv[5]);
+
+ mln::trace::exiting("main");
+}
--
1.5.6.5