30 #include <mln/io/magick/all.hh>
32 #include <scribo/toolchain/text_in_picture.hh>
33 #include <scribo/debug/option_parser.hh>
34 #include <scribo/debug/logger.hh>
39 {
"input.*",
"An image." },
40 {
"output.ppm",
"A color image where the text is highlighted." },
48 {
"fg-extraction",
"Detect and slit foreground/background components. (default: disabled)",
false },
49 {
"ms-bin",
"Use a multi-scale binarization. (default: enabled)",
true },
50 {
"alternate-results",
"Save debug images with all the text bboxes. (default: disabled)",
false },
51 {
"debug",
"Enable debug outputs (default: disabled).",
false },
60 {
"debug-prefix",
"Enable debug image outputs. Prefix image name with that "
61 "given prefix.",
"<prefix>", 0, 1, 0 },
62 {
"max-dim-size",
"Set the maximum size of the largest image dimension.",
"<size>", 0, 1,
"1024" },
63 {
"lambda",
"Set the maximum area of the background objects. It is only useful if fg-extraction is enabled.",
"<size>",
65 {
"verbose",
"Enable verbose mode", 0, 0, 0, 0 },
71 int main(
int argc,
char* argv[])
73 using namespace scribo;
78 if (!options.parse(argc, argv))
81 if (options.is_set(
"debug-prefix"))
84 if (options.is_enabled(
"debug"))
92 bool verbose = options.is_set(
"verbose");
93 unsigned max_dim_size = atoi(options.opt_value(
"max-dim-size").c_str());
94 bool fg_extraction = options.is_enabled(
"fg-extraction");
95 bool multi_scale_bin = options.is_enabled(
"ms-bin");
96 unsigned lambda = atoi(options.opt_value(
"lambda").c_str());
98 if (options.is_enabled(
"alternate-results"))
102 std::cout <<
"Using max_dim_size = " << max_dim_size
103 <<
" - fg_extraction = " << fg_extraction
104 <<
" - multi_scale_bin = " << multi_scale_bin
105 <<
" - lambda = " << lambda << std::endl;
109 fg_extraction, multi_scale_bin,
110 max_dim_size, lambda, verbose);
114 comps.labeled_image(),
116 options.arg(
"output.ppm"));