Commit 56f4535e authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Make use of new logger features.

	* src/binarization/global_threshold.cc,
	* src/binarization/kim.cc,
	* src/binarization/niblack.cc,
	* src/binarization/otsu.cc,
	* src/binarization/sauvola.cc,
	* src/binarization/sauvola_ms.cc,
	* src/binarization/sauvola_ms_debug.cc,
	* src/binarization/sauvola_ms_fg.cc,
	* src/binarization/sauvola_ms_split.cc,
	* src/binarization/wolf.cc: Make use of operator<<.
parent 63becd70
2012-08-23 Guillaume Lazzara <z@lrde.epita.fr>
Make use of new logger features.
* src/binarization/global_threshold.cc,
* src/binarization/kim.cc,
* src/binarization/niblack.cc,
* src/binarization/otsu.cc,
* src/binarization/sauvola.cc,
* src/binarization/sauvola_ms.cc,
* src/binarization/sauvola_ms_debug.cc,
* src/binarization/sauvola_ms_fg.cc,
* src/binarization/sauvola_ms_split.cc,
* src/binarization/wolf.cc: Make use of operator<<.
2012-08-23 Guillaume Lazzara <z@lrde.epita.fr>
Cleanup Kim's binarization.
......
// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2011, 2012 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -57,7 +58,8 @@ static const scribo::debug::opt_data opt_desc[] =
// name, description, arguments, check args function, number of args, default arg
{ "debug-prefix", "Enable debug image outputs. Prefix image name with that "
"given prefix.", "<prefix>", 0, 1, 0 },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{0, 0, 0, 0, 0, 0}
};
......@@ -83,11 +85,9 @@ 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;
scribo::debug::logger() << "Using threshold=" << threshold << std::endl;
image2d<value::rgb8> input;
io::magick::load(input, options.arg("input.*"));
......
......@@ -59,7 +59,8 @@ static const scribo::debug::opt_data opt_desc[] =
{ "debug-prefix", "Enable debug image outputs. Prefix image name with that "
"given prefix.", "<prefix>", 0, 1, 0 },
{ "k", "Sauvola's formulae parameter", "<value>", 0, 1, "0.34" },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{ "win-size", "Window size at scale 1", "<size>", 0, 1, "101" },
{0, 0, 0, 0, 0, 0}
};
......@@ -90,13 +91,9 @@ int main(int argc, char *argv[])
unsigned w_1 = atoi(options.opt_value("win-size").c_str());
double k = atof(options.opt_value("k").c_str());
if (options.is_set("verbose"))
{
scribo::debug::logger().set_verbose_mode(
scribo::debug::txt_to_verbose_mode(options.opt_value("verbose")));
scribo::debug::logger().log(Low, std::string("Using w_1=") + w_1
+ std::string(" - k=") + k);
}
scribo::debug::logger() << "Using w_1=" << w_1
<< " - k=" << k << std::endl;
// Load
image2d<value::rgb8> input_1;
......
// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2011, 2012 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -59,7 +60,8 @@ static const scribo::debug::opt_data opt_desc[] =
{ "debug-prefix", "Enable debug image outputs. Prefix image name with that "
"given prefix.", "<prefix>", 0, 1, 0 },
{ "k", "Niblack's formulae parameter", "<value>", 0, 1, "-0.2" },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{ "win-size", "Window size", "<size>", 0, 1, "101" },
{0, 0, 0, 0, 0, 0}
};
......@@ -86,12 +88,10 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
unsigned w = atoi(options.opt_value("win-size").c_str());
double k = atof(options.opt_value("k").c_str());
if (verbose)
std::cout << "Using w=" << w << " and k=" << k << std::endl;
scribo::debug::logger() << "Using w=" << w << " and k=" << k << std::endl;
image2d<value::rgb8> input;
io::magick::load(input, options.arg("input.*"));
......
// Copyright (C) 2011 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2011, 2012 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -60,7 +61,8 @@ static const scribo::debug::opt_data opt_desc[] =
// name, description, arguments, check args function, number of args, default arg
{ "debug-prefix", "Enable debug image outputs. Prefix image name with that "
"given prefix.", "<prefix>", 0, 1, 0 },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{0, 0, 0, 0, 0, 0}
};
......@@ -86,9 +88,6 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
(void) verbose;
image2d<value::rgb8> input;
io::magick::load(input, options.arg("input.*"));
......
// 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.
......@@ -58,7 +58,8 @@ static const scribo::debug::opt_data opt_desc[] =
{ "debug-prefix", "Enable debug image outputs. Prefix image name with that "
"given prefix.", "<prefix>", 0, 1, 0 },
{ "k", "Sauvola's formulae parameter", "<value>", 0, 1, "0.34" },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{ "win-size", "Window size", "<size>", 0, 1, "101" },
{0, 0, 0, 0, 0, 0}
};
......@@ -85,12 +86,10 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
unsigned w = atoi(options.opt_value("win-size").c_str());
double k = atof(options.opt_value("k").c_str());
if (verbose)
std::cout << "Using w=" << w << " and k=" << k << std::endl;
scribo::debug::logger() << "Using w=" << w << " and k=" << k << std::endl;
image2d<value::rgb8> input;
io::magick::load(input, options.arg("input.*"));
......@@ -99,17 +98,12 @@ 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>());
mln::util::timer t;
t.start();
scribo::debug::logger().start_local_time_logging();
// Binarize
image2d<bool> out = scribo::binarization::sauvola(input_1_gl, w, k);
if (verbose)
{
t.stop();
std::cout << "binarized in " << t << "s" << std::endl;
}
scribo::debug::logger().stop_local_time_logging("Binarized in");
io::pbm::save(out, options.arg("output.pbm"));
......
// 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.
......@@ -70,7 +70,8 @@ static const scribo::debug::opt_data opt_desc[] =
{ "s", "First subsampling ratio. Possible values: 2 or 3.", "ratio",
scribo::debug::check_sauvola_first_subsampling, 1, "3" },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{ "win-size", "Window size at scale 1", "<size>", 0, 1, "101" },
{0, 0, 0, 0, 0, 0}
};
......@@ -102,7 +103,6 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
// Window size
unsigned w_1 = atoi(options.opt_value("win-size").c_str());
// First subsampling scale.
......@@ -122,9 +122,8 @@ int main(int argc, char *argv[])
binarization::internal::k4 = atof(options.opt_value("k4").c_str());
}
if (verbose)
std::cout << "Using w_1=" << w_1 << " - s=" << s
<< " - k=" << k << std::endl;
scribo::debug::logger() << "Using w_1=" << w_1 << " - s=" << s
<< " - k=" << k << std::endl;
......@@ -137,18 +136,14 @@ int main(int argc, char *argv[])
input_1_gl = data::transform(input_1,
mln::fun::v2v::rgb_to_luma<value::int_u8>());
mln::util::timer t;
t.start();
scribo::debug::logger().start_local_time_logging();
// Binarize
image2d<bool>
output = scribo::binarization::sauvola_ms(input_1_gl, w_1, s, k);
if (verbose)
{
t.stop();
std::cout << "binarized in " << t << "s" << std::endl;
}
scribo::debug::logger().stop_local_time_logging("Binarized in");
io::pbm::save(output, options.arg("output.pbm"));
}
// 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.
......@@ -72,7 +72,8 @@ static const scribo::debug::opt_data opt_desc[] =
{ "s", "First subsampling ratio. Possible values: 2 or 3.", "ratio",
scribo::debug::check_sauvola_first_subsampling, 1, "3" },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{ "win-size", "Window size at scale 1", "<size>", 0, 1, "101" },
{0, 0, 0, 0, 0, 0}
};
......@@ -131,7 +132,6 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
// Window size
unsigned w_1 = atoi(options.opt_value("win-size").c_str());
// First subsampling scale.
......@@ -142,9 +142,8 @@ int main(int argc, char *argv[])
binarization::internal::k3 = atof(options.opt_value("k3").c_str());
binarization::internal::k4 = atof(options.opt_value("k4").c_str());
if (verbose)
std::cout << "Using w_1=" << w_1 << " - s=" << s
<< " - k=" << k << std::endl;
scribo::debug::logger() << "Using w_1=" << w_1 << " - s=" << s
<< " - k=" << k << std::endl;
scribo::binarization::internal::scale_image_output = "scale_image.pgm";
scribo::binarization::internal::threshold_image_output = "threshold_image.pbm";
......@@ -162,18 +161,13 @@ int main(int argc, char *argv[])
input_1_gl = data::transform(input_1,
mln::fun::v2v::rgb_to_luma<value::int_u8>());
mln::util::timer t;
t.start();
scribo::debug::logger().start_local_time_logging();
// Binarize.
image2d<bool>
output = scribo::binarization::sauvola_ms(input_1_gl, w_1, s, k);
if (verbose)
{
t.stop();
std::cout << "binarized in " << t << "s" << std::endl;
}
scribo::debug::logger().stop_local_time_logging("Binarized in");
# ifdef SCRIBO_LOCAL_THRESHOLD_DEBUG
{
......
// 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.
......@@ -65,7 +65,8 @@ static const scribo::debug::opt_data opt_desc[] =
"useful if fg-extraction is enabled.", "<size>", 0, 1, "1024" },
{ "s", "First subsampling ratio. Possible values: 2 or 3.", "ratio",
scribo::debug::check_sauvola_first_subsampling, 1, "3" },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{ "win-size", "Window size at scale 1", "<size>", 0, 1, "101" },
{0, 0, 0, 0, 0, 0}
};
......@@ -92,7 +93,6 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
unsigned lambda = atoi(options.opt_value("lambda").c_str());
// Window size
......@@ -102,9 +102,8 @@ int main(int argc, char *argv[])
unsigned s = atoi(options.opt_value("s").c_str());
double k = atof(options.opt_value("k").c_str());
if (verbose)
std::cout << "Using w_1=" << w_1 << " - s=" << s << " - k="
<< k << " - lambda=" << lambda << std::endl;
scribo::debug::logger() << "Using w_1=" << w_1 << " - s=" << s << " - k="
<< k << " - lambda=" << lambda << std::endl;
Magick::InitializeMagick(0);
......
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
// Copyright (C) 2009, 2010, 2012 EPITA Research and Development
// Laboratory (LRDE)
//
// This file is part of Olena.
//
......@@ -67,7 +67,8 @@ static const scribo::debug::opt_data opt_desc[] =
"<num>", scribo::debug::check_sauvola_split_ntrue, 1, "2" },
{ "s", "First subsampling ratio. Possible values: 2 or 3.", "ratio",
scribo::debug::check_sauvola_first_subsampling, 1, "3" },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{ "win-size", "Window size at scale 1", "<size>", 0, 1, "101" },
{0, 0, 0, 0, 0, 0}
};
......@@ -92,7 +93,6 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
// Window size
unsigned w_1 = atoi(options.opt_value("win-size").c_str()); // Scale 1
......@@ -105,11 +105,8 @@ int main(int argc, char *argv[])
binarization::internal::k3 = atof(options.opt_value("k3").c_str());
binarization::internal::k4 = atof(options.opt_value("k4").c_str());
if (verbose)
std::cout << "Using w_1=" << w_1 << " - s=" << s << " - k="
<< k << " - min_ntrue=" << min_ntrue << std::endl;
scribo::debug::logger() << "Using w_1=" << w_1 << " - s=" << s << " - k="
<< k << " - min_ntrue=" << min_ntrue << std::endl;
Magick::InitializeMagick(0);
......
// 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.
......@@ -58,7 +58,8 @@ static const scribo::debug::opt_data opt_desc[] =
{ "debug-prefix", "Enable debug image outputs. Prefix image name with that "
"given prefix.", "<prefix>", 0, 1, 0 },
{ "k", "Wolf's formulae parameter", "<value>", 0, 1, "0.34" },
{ "verbose", "Enable verbose mode", 0, 0, 0, 0 },
{ "verbose", "Enable verbose mode (mute, time, low, medium, full)",
"<mode>", scribo::debug::check_verbose_mode, 1, "mute" },
{ "win-size", "Window size", "<size>", 0, 1, "101" },
{0, 0, 0, 0, 0, 0}
};
......@@ -85,12 +86,10 @@ int main(int argc, char *argv[])
trace::entering("main");
bool verbose = options.is_set("verbose");
unsigned w = atoi(options.opt_value("win-size").c_str());
double k = atof(options.opt_value("k").c_str());
if (verbose)
std::cout << "Using w=" << w << " and k=" << k << std::endl;
scribo::debug::logger() << "Using w=" << w << " and k=" << k << std::endl;
image2d<value::rgb8> input;
io::magick::load(input, options.arg("input.*"));
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment