Commit d4370554 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Fix binarization programs.

	* src/binarization/sauvola_ms.cc: Add negate option.

	* src/binarization/sauvola_ms_debug.cc: Fix invalid k parameter
	value.
parent 54991aca
2013-01-24 Guillaume Lazzara <z@lrde.epita.fr>
Fix binarization programs.
* src/binarization/sauvola_ms.cc: Add negate option.
* src/binarization/sauvola_ms_debug.cc: Fix invalid k parameter
value.
2012-11-05 Guillaume Lazzara <z@lrde.epita.fr>
* scribo/binarization/sauvola_ms.hh: Fix overlapping area
......
......@@ -33,6 +33,7 @@
#include <mln/data/transform.hh>
#include <mln/fun/v2v/rgb_to_luma.hh>
#include <mln/util/timer.hh>
#include <mln/logical/not.hh>
#include <scribo/binarization/sauvola_ms.hh>
#include <scribo/debug/option_parser.hh>
......@@ -50,6 +51,7 @@ static const scribo::debug::arg_data arg_desc[] =
static const scribo::debug::toggle_data toggle_desc[] =
{
// name, description, default value
{ "negate", "Negate output image.", false},
{0, 0, false}
};
......@@ -147,5 +149,8 @@ int main(int argc, char *argv[])
scribo::debug::logger().stop_local_time_logging("Binarized in");
io::magick::save(output, options.arg("output.*"));
if (options.is_enabled("negate"))
io::magick::save(logical::not_(output), options.arg("output.*"));
else
io::magick::save(output, options.arg("output.*"));
}
......@@ -66,9 +66,9 @@ static const scribo::debug::opt_data opt_desc[] =
"given prefix.", "<prefix>", 0, 1, 0 },
{ "all-k", "Sauvola's formulae parameter", "<value>", 0, 1, "0.34" },
{ "k2", "Sauvola's formulae parameter", "<value>", 0, 1, "0.20" },
{ "k3", "Sauvola's formulae parameter", "<value>", 0, 1, "0.30" },
{ "k4", "Sauvola's formulae parameter", "<value>", 0, 1, "0.50" },
{ "k2", "Sauvola's formulae parameter", "<value>", 0, 1, 0 },
{ "k3", "Sauvola's formulae parameter", "<value>", 0, 1, 0 },
{ "k4", "Sauvola's formulae parameter", "<value>", 0, 1, 0 },
{ "s", "First subsampling ratio. Possible values: 2 or 3.", "ratio",
scribo::debug::check_sauvola_first_subsampling, 1, "3" },
......@@ -190,7 +190,7 @@ int main(int argc, char *argv[])
for (unsigned i = 0; i < geom::nrows(output); ++i)
for (unsigned j = 0; j < geom::ncols(output); ++j)
if (output.at_(i,j))
scale_bin.at_(i,j) = binarization::internal::debug_e_2.at_(i/3, j/3);
scale_bin.at_(i,j) = binarization::internal::debug_e_2.at_(i/s, j/s);
else
scale_bin.at_(i,j) = 0;
......
Supports Markdown
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