* scribo/src/binarization/Makefile.am: Remove targets.
* src/binarization/pgm_sauvola.cc,
* src/binarization/pgm_sauvola_ms.cc,
* src/binarization/pgm_sauvola_threshold_image.cc,
* src/binarization/ppm_sauvola.cc,
* src/binarization/ppm_sauvola_ms.cc,
* src/binarization/ppm_sauvola_ms_fg.cc,
* src/binarization/ppm_sauvola_ms_split.cc: Remove.
---
scribo/ChangeLog | 14 ++
scribo/src/binarization/Makefile.am | 20 +---
scribo/src/binarization/pgm_sauvola.cc | 80 ------------
scribo/src/binarization/pgm_sauvola_ms.cc | 111 ----------------
.../binarization/pgm_sauvola_threshold_image.cc | 78 ------------
scribo/src/binarization/ppm_sauvola.cc | 88 -------------
scribo/src/binarization/ppm_sauvola_ms.cc | 123 ------------------
scribo/src/binarization/ppm_sauvola_ms_fg.cc | 134 --------------------
scribo/src/binarization/ppm_sauvola_ms_split.cc | 128 -------------------
9 files changed, 16 insertions(+), 760 deletions(-)
delete mode 100644 scribo/src/binarization/pgm_sauvola.cc
delete mode 100644 scribo/src/binarization/pgm_sauvola_ms.cc
delete mode 100644 scribo/src/binarization/pgm_sauvola_threshold_image.cc
delete mode 100644 scribo/src/binarization/ppm_sauvola.cc
delete mode 100644 scribo/src/binarization/ppm_sauvola_ms.cc
delete mode 100644 scribo/src/binarization/ppm_sauvola_ms_fg.cc
delete mode 100644 scribo/src/binarization/ppm_sauvola_ms_split.cc
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index 28de74b..69814de 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,19 @@
2012-04-05 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Remove useless targets in scribo/src/binarization.
+
+ * scribo/src/binarization/Makefile.am: Remove targets.
+
+ * src/binarization/pgm_sauvola.cc,
+ * src/binarization/pgm_sauvola_ms.cc,
+ * src/binarization/pgm_sauvola_threshold_image.cc,
+ * src/binarization/ppm_sauvola.cc,
+ * src/binarization/ppm_sauvola_ms.cc,
+ * src/binarization/ppm_sauvola_ms_fg.cc,
+ * src/binarization/ppm_sauvola_ms_split.cc: Remove.
+
+2012-04-05 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Cleanup text_in_picture_dual.
* src/Makefile.am: Update target name.
diff --git a/scribo/src/binarization/Makefile.am b/scribo/src/binarization/Makefile.am
index 567972a..a0a4378 100644
--- a/scribo/src/binarization/Makefile.am
+++ b/scribo/src/binarization/Makefile.am
@@ -1,4 +1,4 @@
-# Copyright (C) 2009, 2010, 2011 EPITA Research and Development
+# Copyright (C) 2009, 2010, 2011, 2012 EPITA Research and Development
# Laboratory (LRDE).
#
# This file is part of Olena.
@@ -18,25 +18,9 @@
include $(top_srcdir)/scribo/scribo.mk
noinst_PROGRAMS = \
- pgm_global_threshold_auto \
- pgm_sauvola \
- pgm_sauvola_ms \
- pgm_sauvola_threshold_image \
- ppm_sauvola \
- ppm_sauvola_ms_fg \
- ppm_sauvola_ms \
- ppm_sauvola_ms_split
-
+ pgm_global_threshold_auto
pgm_global_threshold_auto_SOURCES = pgm_global_threshold_auto.cc
-pgm_sauvola_SOURCES = pgm_sauvola.cc
-pgm_sauvola_ms_SOURCES = pgm_sauvola_ms.cc
-pgm_sauvola_threshold_image_SOURCES = pgm_sauvola_threshold_image.cc
-ppm_sauvola_SOURCES = ppm_sauvola.cc
-ppm_sauvola_ms_fg_SOURCES = ppm_sauvola_ms_fg.cc
-ppm_sauvola_ms_SOURCES = ppm_sauvola_ms.cc
-ppm_sauvola_ms_split_SOURCES = ppm_sauvola_ms_split.cc
-
if HAVE_MAGICKXX
diff --git a/scribo/src/binarization/pgm_sauvola.cc
b/scribo/src/binarization/pgm_sauvola.cc
deleted file mode 100644
index 1052766..0000000
--- a/scribo/src/binarization/pgm_sauvola.cc
+++ /dev/null
@@ -1,80 +0,0 @@
-// Copyright (C) 2009, 2010 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/io/pgm/load.hh>
-#include <mln/io/pbm/save.hh>
-
-#include <scribo/binarization/sauvola.hh>
-#include <scribo/debug/usage.hh>
-
-const char *args_desc[][2] =
-{
- { "input.pgm", "A gray level image." },
- { "output.pbm", "A binary image." },
- { "w", "Window size (default 101)." },
- { "k", "Sauvola's formulae parameter (default 0.34)." },
- {0, 0}
-};
-
-
-int main(int argc, char *argv[])
-{
- using namespace mln;
- using value::int_u8;
-
- if (argc != 5 && argc != 4 && argc != 3)
- return scribo::debug::usage(argv,
- "Binarization of a gray level image based on Sauvola's algorithm.",
- "input.pgm output.pbm <w> <k>",
- args_desc);
-
- trace::entering("main");
-
- unsigned w;
- if (argc == 4)
- w = atoi(argv[3]);
- else
- w = 101;
-
- double k;
- if (argc == 5)
- k = atof(argv[4]);
- else
- k = 0.34f;
-
- std::cout << "Using w=" << w << " and k="
<< k << std::endl;
-
- image2d<int_u8> input;
- io::pgm::load(input, argv[1]);
-
- image2d<bool> out = scribo::binarization::sauvola(input, w, k);
-
-
- io::pbm::save(out, argv[2]);
-
-
- trace::exiting("main");
-}
diff --git a/scribo/src/binarization/pgm_sauvola_ms.cc
b/scribo/src/binarization/pgm_sauvola_ms.cc
deleted file mode 100644
index 38ff2e6..0000000
--- a/scribo/src/binarization/pgm_sauvola_ms.cc
+++ /dev/null
@@ -1,111 +0,0 @@
-// Copyright (C) 2009, 2010 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/int_u8.hh>
-#include <mln/io/pgm/load.hh>
-#include <mln/io/pbm/save.hh>
-
-#include <scribo/binarization/sauvola_ms.hh>
-#include <scribo/debug/usage.hh>
-
-bool check_args(int argc, char * argv[])
-{
- if (argc < 3 || argc > 6)
- return false;
-
- if (argc >= 5)
- {
- int s = atoi(argv[4]);
-
- if (s < 1 || s > 3)
- {
- std::cout << "s must be set to 2 or 3."
- << std::endl;
- return false;
- }
- }
-
- return true;
-}
-
-
-const char *args_desc[][2] =
-{
- { "input.pgm", "A graylevel image." },
- { "out.pbm", "A binary image." },
- { "w", "Window size at scale 1. (default: 101)" },
- { "s", "First subsampling ratio (default: 3)." },
- { "k", "Sauvola's formuale parameter (default: 0.34)" },
- {0, 0}
-};
-
-
-
-
-int main(int argc, char *argv[])
-{
- using namespace mln;
- using namespace scribo;
-
- if (!check_args(argc, argv))
- return scribo::debug::usage(argv,
- "Multi-Scale Binarization of a color image based on Sauvola's
algorithm.",
- "input.pgm output.pbm <w> <s> <k>",
- args_desc);
-
- trace::entering("main");
-
- // Window size
- unsigned w_1;
- if (argc >= 4)
- w_1 = atoi(argv[3]); // Scale 1
- else
- w_1 = 101u;
-
- // First subsampling scale.
- unsigned s;
- if (argc >= 5)
- s = atoi(argv[4]);
- else
- s = 3u;
-
- double k;
- if (argc >= 6)
- k = atof(argv[5]);
- else
- k = 0.34f;
-
- image2d<value::int_u8> input_1;
- io::pgm::load(input_1, argv[1]);
-
- image2d<bool>
- output = scribo::binarization::sauvola_ms(input_1, w_1, s, k);
-
- io::pbm::save(output, argv[2]);
-}
-
-
diff --git a/scribo/src/binarization/pgm_sauvola_threshold_image.cc
b/scribo/src/binarization/pgm_sauvola_threshold_image.cc
deleted file mode 100644
index 69e2e15..0000000
--- a/scribo/src/binarization/pgm_sauvola_threshold_image.cc
+++ /dev/null
@@ -1,78 +0,0 @@
-// Copyright (C) 2010, 2011 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/io/pgm/all.hh>
-
-#include <scribo/binarization/sauvola_threshold.hh>
-#include <scribo/debug/usage.hh>
-
-const char *args_desc[][2] =
-{
- { "input.pgm", "A graylevel image." },
- { "output.pgm", "A threshold image." },
- { "w", "Window size (default 101)." },
- { "k", "Sauvola's formulae parameter (default 0.34)." },
- {0, 0}
-};
-
-
-int main(int argc, char *argv[])
-{
- using namespace mln;
-
- if (argc != 5 && argc != 4 && argc != 3)
- return scribo::debug::usage(argv,
- "Compute a threshold image based on Sauvola's algorithm.",
- "input.pgm output.pgm <w> <k>",
- args_desc);
-
- trace::entering("main");
-
- unsigned w;
- if (argc >= 4)
- w = atoi(argv[3]);
- else
- w = 101;
-
- double k;
- if (argc >= 5)
- k = atof(argv[4]);
- else
- k = 0.34f;
-
- std::cout << "Using w=" << w << " and k="
<< k << std::endl;
-
- image2d<value::int_u8> input;
- io::pgm::load(input, argv[1]);
-
- image2d<value::int_u8> out = scribo::binarization::sauvola_threshold(input, w,
k);
-
-
- io::pgm::save(out, argv[2]);
-
-
- trace::exiting("main");
-}
diff --git a/scribo/src/binarization/ppm_sauvola.cc
b/scribo/src/binarization/ppm_sauvola.cc
deleted file mode 100644
index 4732a02..0000000
--- a/scribo/src/binarization/ppm_sauvola.cc
+++ /dev/null
@@ -1,88 +0,0 @@
-// Copyright (C) 2009, 2010, 2011 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/io/ppm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/data/transform.hh>
-#include <mln/fun/v2v/rgb_to_luma.hh>
-
-#include <scribo/binarization/sauvola.hh>
-#include <scribo/debug/usage.hh>
-
-const char *args_desc[][2] =
-{
- { "input.ppm", "A color image." },
- { "output.pbm", "A binary image." },
- { "w", "Window size (default 101)." },
- { "k", "Sauvola's formulae parameter (default 0.34)." },
- {0, 0}
-};
-
-
-int main(int argc, char *argv[])
-{
- using namespace mln;
-
- if (argc != 5 && argc != 4 && argc != 3)
- return scribo::debug::usage(argv,
- "Binarization of a gray level image based on Sauvola's algorithm.",
- "input.ppm output.pbm <w> <k>",
- args_desc);
-
- trace::entering("main");
-
- unsigned w;
- if (argc == 4)
- w = atoi(argv[3]);
- else
- w = 101;
-
- double k;
- if (argc == 5)
- k = atof(argv[4]);
- else
- k = 0.34f;
-
- std::cout << "Using w=" << w << " and k="
<< k << std::endl;
-
- // Load
- image2d<value::rgb8> input;
- io::ppm::load(input, argv[1]);
-
- // Convert to Gray level image.
- image2d<value::int_u8>
- input_gl = data::transform(input,
- mln::fun::v2v::rgb_to_luma<value::int_u8>());
-
- // Binarize
- image2d<bool> out = scribo::binarization::sauvola(input_gl, w, k);
-
-
- io::pbm::save(out, argv[2]);
-
-
- trace::exiting("main");
-}
diff --git a/scribo/src/binarization/ppm_sauvola_ms.cc
b/scribo/src/binarization/ppm_sauvola_ms.cc
deleted file mode 100644
index cff28f9..0000000
--- a/scribo/src/binarization/ppm_sauvola_ms.cc
+++ /dev/null
@@ -1,123 +0,0 @@
-// Copyright (C) 2009, 2010, 2011 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/int_u8.hh>
-#include <mln/io/ppm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/data/transform.hh>
-#include <mln/fun/v2v/rgb_to_luma.hh>
-
-#include <scribo/binarization/sauvola_ms.hh>
-#include <scribo/debug/usage.hh>
-
-bool check_args(int argc, char * argv[])
-{
- if (argc < 3 || argc > 6)
- return false;
-
- if (argc >= 5)
- {
- int s = atoi(argv[4]);
-
- if (s < 1 || s > 3)
- {
- std::cout << "s must be set to 2 or 3."
- << std::endl;
- return false;
- }
- }
-
- return true;
-}
-
-
-const char *args_desc[][2] =
-{
- { "input.ppm", "A color image." },
- { "out.pbm", "A binary image." },
- { "w", "Window size at scale 1. (default: 101)" },
- { "s", "First subsampling ratio (default: 3)." },
- { "k", "Sauvola's formuale parameter (default: 0.34)" },
- {0, 0}
-};
-
-
-
-
-int main(int argc, char *argv[])
-{
- using namespace mln;
- using namespace scribo;
-
- if (!check_args(argc, argv))
- return scribo::debug::usage(argv,
- "Multi-Scale Binarization of a color image based on Sauvola's
algorithm.",
- "input.ppm output.pbm <w> <s> <k>",
- args_desc);
-
- trace::entering("main");
-
- // Window size
- unsigned w_1;
- if (argc >= 4)
- w_1 = atoi(argv[3]); // Scale 1
- else
- w_1 = 101u;
-
- // First subsampling scale.
- unsigned s;
- if (argc >= 5)
- s = atoi(argv[4]);
- else
- s = 3u;
-
- double k;
- if (argc >= 6)
- k = atof(argv[5]);
- else
- k = 0.34f;
-
- std::cout << "Using w_1=" << w_1 << " - s="
<< s
- << " - k=" << k << std::endl;
-
- // Load
- image2d<value::rgb8> input_1;
- io::ppm::load(input_1, argv[1]);
-
- // Convert to Gray level image.
- image2d<value::int_u8>
- input_1_gl = data::transform(input_1,
- mln::fun::v2v::rgb_to_luma<value::int_u8>());
-
- // Binarize
- image2d<bool>
- output = scribo::binarization::sauvola_ms(input_1_gl, w_1, s, k);
-
- io::pbm::save(output, argv[2]);
-}
-
-
diff --git a/scribo/src/binarization/ppm_sauvola_ms_fg.cc
b/scribo/src/binarization/ppm_sauvola_ms_fg.cc
deleted file mode 100644
index a17ce9f..0000000
--- a/scribo/src/binarization/ppm_sauvola_ms_fg.cc
+++ /dev/null
@@ -1,134 +0,0 @@
-// Copyright (C) 2009, 2010, 2011 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.
-
-/// \file
-
-#include <mln/core/image/image2d.hh>
-#include <mln/value/rgb8.hh>
-#include <mln/io/ppm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/data/transform.hh>
-#include <mln/fun/v2v/rgb_to_luma.hh>
-
-#include <scribo/binarization/sauvola_ms.hh>
-#include <scribo/preprocessing/split_bg_fg.hh>
-#include <scribo/debug/usage.hh>
-
-bool check_args(int argc, char * argv[])
-{
- if (argc < 3 || argc > 7)
- return false;
-
- if (argc >= 6)
- {
- int s = atoi(argv[5]);
-
- if (s < 2 || s > 3)
- {
- std::cout << "s must be set to 2 or 3."
- << std::endl;
- return false;
- }
- }
-
- return true;
-}
-
-
-const char *args_desc[][2] =
-{
- { "input.ppm", "A color image." },
- { "output.pbm", "A binary image." },
- { "lambda", "Lambda used to split bg/fg." },
- { "w", "Window size at scale 1. (default: 101)" },
- { "s", "First subsampling ratio. (default: 3)" },
- { "k", "Sauvola's formula parameter. (default: 0.34)" },
- {0, 0}
-};
-
-
-
-
-int main(int argc, char *argv[])
-{
- using namespace mln;
- using namespace scribo;
-
- if (!check_args(argc, argv))
- return scribo::debug::usage(argv,
- "Multi-Scale Binarization of a color image based on Sauvola's algorithm.
Performs a binarization on each component of the color image and merges the
results.",
- "input.ppm output.pbm lambda <w> <s> <k>",
- args_desc);
-
- trace::entering("main");
-
- unsigned lambda = atoi(argv[3]);
-
- // Window size
- unsigned w_1;
- if (argc >= 5)
- w_1 = atoi(argv[4]); // Scale 1
- else
- w_1 = 101u;
-
- // First subsampling scale.
- unsigned s;
- if (argc >= 6)
- s = atoi(argv[5]);
- else
- s = 3u;
-
- double k;
- if (argc >= 7)
- k = atof(argv[6]);
- else
- k = 0.34f;
-
- std::cout << "Using w_1=" << w_1 << " - s="
<< s
- << " - k=" << k << std::endl;
-
- // Load
- image2d<value::rgb8> input_1;
- io::ppm::load(input_1, argv[1]);
-
-
- // Split foreground/background
- image2d<value::rgb8>
- fg = scribo::preprocessing::split_bg_fg(input_1, lambda, 32).second();
-
-
- // Convert to Gray level image.
- image2d<value::int_u8>
- fg_gl = data::transform(fg, mln::fun::v2v::rgb_to_luma<value::int_u8>());
-
- // Binarize
- image2d<bool>
- output = scribo::binarization::sauvola_ms(fg_gl, w_1, s, k);
-
- io::pbm::save(output, argv[2]);
-}
-
-
diff --git a/scribo/src/binarization/ppm_sauvola_ms_split.cc
b/scribo/src/binarization/ppm_sauvola_ms_split.cc
deleted file mode 100644
index 92a0817..0000000
--- a/scribo/src/binarization/ppm_sauvola_ms_split.cc
+++ /dev/null
@@ -1,128 +0,0 @@
-// Copyright (C) 2009, 2010, 2011 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/rgb8.hh>
-#include <mln/io/ppm/load.hh>
-#include <mln/io/pbm/save.hh>
-#include <mln/data/transform.hh>
-
-#include <scribo/binarization/sauvola_ms_split.hh>
-#include <scribo/debug/usage.hh>
-
-bool check_args(int argc, char * argv[])
-{
- if (argc < 3 || argc > 7)
- return false;
-
- if (argc >= 5)
- {
- int s = atoi(argv[4]);
-
- if (s < 1 || s > 3)
- {
- std::cout << "s must be set to 2 or 3."
- << std::endl;
- return false;
- }
- }
-
- return true;
-}
-
-
-const char *args_desc[][2] =
-{
- { "input.ppm", "A color image." },
- { "output.pbm", "A binary image." },
- { "w", "Window size at scale 1. (default: 101)" },
- { "s", "First subsampling ratio (default: 3)." },
- { "min_ntrue", "The number of components in which a site must be set
to 'True' in order to be set to 'True' in the output (Possible values: 1,
2, 3). (default: 2)" },
- { "K", "Sauvola's formula parameter (default: 0.34)." },
- {0, 0}
-};
-
-
-
-
-int main(int argc, char *argv[])
-{
- using namespace mln;
- using namespace scribo;
-
- if (!check_args(argc, argv))
- return scribo::debug::usage(argv,
- "Multi-Scale Binarization of a color image based on Sauvola's algorithm.
Performs a binarization on each component of the color image and merges the
results.",
- "input.ppm output.pbm <w> <s> <min_ntrue> <K>",
- args_desc);
-
- trace::entering("main");
-
- // Window size
- unsigned w_1;
- if (argc >= 4)
- w_1 = atoi(argv[3]); // Scale 1
- else
- w_1 = 101u;
-
- // First subsampling scale.
- unsigned s;
- if (argc >= 5)
- s = atoi(argv[4]);
- else
- s = 3u;
-
- // min_ntrue
- unsigned min_ntrue;
- if (argc >= 6)
- min_ntrue = atoi(argv[5]);
- else
- min_ntrue = 2;
-
-
- double k;
- if (argc >= 7)
- k = atof(argv[6]);
- else
- k = 0.34f;
-
-
- // Load
- image2d<value::rgb8> input_1;
- io::ppm::load(input_1, argv[1]);
-
- std::cout << "Using w=" << w_1 << " - s="
<< s
- << " - min_ntrue=" << min_ntrue << " - k="
<< k << std::endl;
-
- // Binarize
- image2d<bool>
- output = scribo::binarization::sauvola_ms_split(input_1, w_1, s,
- min_ntrue, k);
-
- io::pbm::save(output, argv[2]);
-}
-
-
--
1.7.2.5