* src/binarization/Makefile.am: Add a new target.
* src/binarization/global_threshold.cc: New.
---
scribo/ChangeLog | 8 ++++++++
scribo/src/binarization/Makefile.am | 7 +++++++
.../binarization/{otsu.cc => global_threshold.cc} | 9 +++++++--
3 files changed, 22 insertions(+), 2 deletions(-)
copy scribo/src/binarization/{otsu.cc => global_threshold.cc} (90%)
diff --git a/scribo/ChangeLog b/scribo/ChangeLog
index f18c774..5aa2a06 100644
--- a/scribo/ChangeLog
+++ b/scribo/ChangeLog
@@ -1,5 +1,13 @@
2011-10-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add a new tool for global thresholding.
+
+ * src/binarization/Makefile.am: Add a new target.
+
+ * src/binarization/global_threshold.cc: New.
+
+2011-10-14 Guillaume Lazzara <z(a)lrde.epita.fr>
+
* tests/binarization/global_threshold.cc: Fix test.
2011-10-14 Guillaume Lazzara <z(a)lrde.epita.fr>
diff --git a/scribo/src/binarization/Makefile.am b/scribo/src/binarization/Makefile.am
index fc96572..315e621 100644
--- a/scribo/src/binarization/Makefile.am
+++ b/scribo/src/binarization/Makefile.am
@@ -41,6 +41,7 @@ ppm_sauvola_ms_split_SOURCES = ppm_sauvola_ms_split.cc
if HAVE_MAGICKXX
noinst_PROGRAMS += \
+ global_threshold \
sauvola_debug \
sauvola_ms_debug
@@ -52,6 +53,12 @@ if HAVE_MAGICKXX
sauvola_ms_split
+ global_threshold_SOURCES = global_threshold.cc
+ global_threshold_CPPFLAGS = $(AM_CPPFLAGS) \
+ $(MAGICKXX_CPPFLAGS)
+ global_threshold_LDFLAGS = $(AM_LDFLAGS) \
+ $(MAGICKXX_LDFLAGS)
+
otsu_SOURCES = otsu.cc
otsu_CPPFLAGS = $(AM_CPPFLAGS) \
diff --git a/scribo/src/binarization/otsu.cc
b/scribo/src/binarization/global_threshold.cc
similarity index 90%
copy from scribo/src/binarization/otsu.cc
copy to scribo/src/binarization/global_threshold.cc
index 7673363..276ec2e 100644
--- a/scribo/src/binarization/otsu.cc
+++ b/scribo/src/binarization/global_threshold.cc
@@ -30,13 +30,14 @@
#include <mln/data/transform.hh>
#include <mln/fun/v2v/rgb_to_luma.hh>
-#include <scribo/binarization/otsu.hh>
+#include <scribo/binarization/global_threshold.hh>
#include <scribo/debug/option_parser.hh>
#include <scribo/debug/logger.hh>
static const scribo::debug::arg_data arg_desc[] =
{
{ "input.*", "An image." },
+ { "threshold_value", "Global threshold to apply." },
{ "output.pbm", "A binary image." },
{0, 0}
};
@@ -83,6 +84,10 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
+ unsigned threshold = atoi(options.arg("threshold_value"));
+
+ if (verbose)
+ std::cout << "Using threshold=" << threshold <<
std::endl;
image2d<value::rgb8> input;
io::magick::load(input, options.arg("input.*"));
@@ -91,7 +96,7 @@ int main(int argc, char *argv[])
image2d<value::int_u8>
input_1_gl = data::transform(input,
mln::fun::v2v::rgb_to_luma<value::int_u8>());
- image2d<bool> out = scribo::binarization::otsu(input_1_gl);
+ image2d<bool> out = scribo::binarization::global_threshold(input_1_gl,
threshold);
io::pbm::save(out, options.arg("output.pbm"));
--
1.7.2.5
Show replies by date