Commit 9873b787 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Compilation fixes.

	* scribo/binarization/sauvola_threshold_image.hh: Fix namespace
	ambiguity.

	* scribo/io/xml/save.hh
	* scribo/primitive/extract/elements.hh
	* scribo/primitive/merge/components.hh
	* scribo/toolchain/text_in_doc_preprocess.hh
	* scribo/toolchain/text_in_picture.hh
	* src/binarization/ppm_sauvola_ms.cc
	* src/binarization/ppm_sauvola_ms_fg.cc
	* src/binarization/ppm_sauvola_ms_split.cc
	* src/binarization/sauvola_ms.cc
	* src/binarization/sauvola_ms_fg.cc
	* src/binarization/sauvola_ms_split.cc
	* src/contest/hdibco-2010/sauvola_ms_hdibco.cc
	* src/text_in_picture.cc: Add missing includes.

	* scribo/primitive/extract/lines_h_pattern.hh,
	* scribo/primitive/extract/lines_v_pattern.hh: Make sure the
	rectangle have odd dimensions.

	* src/Makefile.am: Remove deprecated include path.

	* src/binarization/ppm_sauvola.cc: Convert to gray level.

	* src/pbm_text_in_doc.cc: Use doc structure.

	* src/text_in_picture_neg.cc: Make use of world::rgb::invert.
parent 92e2d041
2010-11-16 Guillaume Lazzara <z@lrde.epita.fr>
Compilation fixes.
* scribo/binarization/sauvola_threshold_image.hh: Fix namespace
ambiguity.
* scribo/io/xml/save.hh
* scribo/primitive/extract/elements.hh
* scribo/primitive/merge/components.hh
* scribo/toolchain/text_in_doc_preprocess.hh
* scribo/toolchain/text_in_picture.hh
* src/binarization/ppm_sauvola_ms.cc
* src/binarization/ppm_sauvola_ms_fg.cc
* src/binarization/ppm_sauvola_ms_split.cc
* src/binarization/sauvola_ms.cc
* src/binarization/sauvola_ms_fg.cc
* src/binarization/sauvola_ms_split.cc
* src/contest/hdibco-2010/sauvola_ms_hdibco.cc
* src/text_in_picture.cc: Add missing includes.
* scribo/primitive/extract/lines_h_pattern.hh,
* scribo/primitive/extract/lines_v_pattern.hh: Make sure the
rectangle have odd dimensions.
* src/Makefile.am: Remove deprecated include path.
* src/binarization/ppm_sauvola.cc: Convert to gray level.
* src/pbm_text_in_doc.cc: Use doc structure.
* src/text_in_picture_neg.cc: Make use of world::rgb::invert.
2010-11-16 Guillaume Lazzara <z@lrde.epita.fr>
* scribo/core/document.hh: Add new methods.
......
......@@ -144,8 +144,8 @@ namespace scribo
ncols = static_cast<mln::def::coord>(input.ncols());
for(def::coord row = 0; row < nrows; ++row)
for(def::coord col = 0; col < ncols; ++col)
for(mln::def::coord row = 0; row < nrows; ++row)
for(mln::def::coord col = 0; col < ncols; ++col)
{
# ifdef SCRIBO_SAUVOLA_DEBUG
......
......@@ -35,6 +35,7 @@
# include <map>
# include <scribo/core/document.hh>
# include <scribo/core/line_set.hh>
namespace scribo
......
......@@ -33,6 +33,7 @@
# define SCRIBO_PRIMITIVE_EXTRACT_ELEMENTS_HH
# include <mln/core/image/image2d.hh>
# include <mln/core/alias/neighb2d.hh>
# include <mln/data/fill.hh>
# include <mln/util/array.hh>
# include <mln/labeling/compute.hh>
......@@ -40,16 +41,21 @@
# include <mln/accu/math/count.hh>
# include <mln/pw/all.hh>
# include <mln/draw/box_plain.hh>
# include <mln/value/label_8.hh>
# include <mln/value/rgb.hh>
# include <mln/value/rgb8.hh>
# include <scribo/core/macros.hh>
# include <scribo/core/component_set.hh>
# include <scribo/core/document.hh>
# include <scribo/core/line_set.hh>
# include <scribo/core/def/lbl_type.hh>
# include <scribo/filter/objects_small.hh>
#include <mln/clustering/kmean_rgb.hh>
#include <mln/fun/v2v/rgb8_to_rgbn.hh>
# include <mln/clustering/kmean_rgb.hh>
# include <mln/fun/v2v/rgb8_to_rgbn.hh>
namespace scribo
{
......@@ -60,6 +66,8 @@ namespace scribo
namespace extract
{
using namespace mln;
template <typename L, typename I>
component_set<L>
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -30,6 +31,8 @@
///
/// Extract horizontal lines matching a specific pattern.
# include <cmath>
# include <mln/core/concept/image.hh>
# include <mln/core/alias/window2d.hh>
# include <mln/win/rectangle2d.hh>
......@@ -103,9 +106,12 @@ namespace scribo
mln_concrete(I) output = lines_pattern(input, length, 1, win);
unsigned new_length = length / 2 + delta;
new_length += 1 - (new_length % 2); // Guaranty that new_length is odd.
mln_concrete(I)
output_dil = morpho::dilation(output,
win::rectangle2d(3, length / 2 + delta));
win::rectangle2d(3, new_length));
output = scribo::primitive::internal::rd(output, input * output_dil);
......
// Copyright (C) 2009 EPITA Research and Development Laboratory (LRDE)
// Copyright (C) 2009, 2010 EPITA Research and Development Laboratory
// (LRDE)
//
// This file is part of Olena.
//
......@@ -30,6 +31,8 @@
///
/// Extract vertical lines matching a specific pattern.
# include <cmath>
# include <mln/core/concept/image.hh>
# include <mln/core/alias/window2d.hh>
# include <mln/win/rectangle2d.hh>
......@@ -85,9 +88,12 @@ namespace scribo
mln_concrete(I) output = lines_pattern(input, length, 0, win);
unsigned new_length = length / 2 + delta;
new_length += 1 - (new_length % 2); // Guaranty that new_length is odd.
mln_concrete(I)
output_dil = morpho::dilation(output,
win::rectangle2d(length / 2 + delta, 3));
win::rectangle2d(new_length, 3));
output = scribo::primitive::internal::rd(output, input * output_dil);
......
......@@ -30,7 +30,12 @@
#ifndef SCRIBO_PRIMITIVE_MERGE_COMPONENTS_HH
# define SCRIBO_PRIMITIVE_MERGE_COMPONENTS_HH
# include <mln/core/concept/function.hh>
# include <mln/core/image/vmorph/fun_image.hh>
# include <mln/data/fill.hh>
# include <mln/pw/all.hh>
# include <scribo/core/component_set.hh>
namespace scribo
......
......@@ -32,6 +32,8 @@
#include <mln/core/concept/image.hh>
#include <mln/data/transform.hh>
#include <mln/fun/v2v/rgb_to_int_u.hh>
#include <scribo/binarization/sauvola_ms.hh>
......
......@@ -33,11 +33,58 @@
/// Localize text in a picture.
# include <libgen.h>
# include <iostream>
# include <mln/core/image/image2d.hh>
# include <mln/core/alias/neighb2d.hh>
#include <src/afp/components.hh>
#include <src/afp/link.hh>
#include <src/afp/regroup.hh>
# include <mln/literal/colors.hh>
# include <mln/value/rgb8.hh>
# include <mln/value/label_16.hh>
# include <mln/fun/v2v/rgb_to_int_u.hh>
# include <mln/subsampling/antialiased.hh>
# include <scribo/draw/bounding_boxes.hh>
# include <scribo/draw/groups_bboxes.hh>
# include <scribo/binarization/sauvola_ms.hh>
# include <scribo/binarization/sauvola.hh>
# include <scribo/primitive/extract/components.hh>
# include <scribo/primitive/link/merge_double_link.hh>
# include <scribo/primitive/link/with_single_left_link.hh>
# include <scribo/primitive/link/with_single_right_link.hh>
# include <scribo/primitive/group/apply.hh>
# include <scribo/primitive/group/from_double_link.hh>
# include <scribo/primitive/group/from_single_link.hh>
# include <scribo/primitive/regroup/from_single_left_link.hh>
# include <scribo/filter/object_groups_with_holes.hh>
# include <scribo/filter/object_links_bbox_h_ratio.hh>
# include <scribo/filter/object_links_bbox_overlap.hh>
# include <scribo/filter/object_groups_small.hh>
# include <scribo/filter/object_groups_v_thickness.hh>
# include <scribo/debug/decision_image.hh>
# include <scribo/debug/save_linked_bboxes_image.hh>
# include <scribo/debug/usage.hh>
# include <scribo/preprocessing/split_bg_fg.hh>
# include <scribo/make/debug_filename.hh>
# include <src/afp/components.hh>
# include <src/afp/link.hh>
# include <src/afp/regroup.hh>
# include <mln/util/timer.hh>
......@@ -126,7 +173,7 @@ namespace scribo
trace::entering("scribo::toolchain::text_in_picture");
const I& input_rgb_orig = exact(input_rgb_orig_);
mln_precondition(input.is_valid());
mln_precondition(input_rgb_orig.is_valid());
using namespace scribo;
using namespace scribo::primitive;
......
......@@ -99,8 +99,6 @@ if HAVE_TESSERACT
utilexec_PROGRAMS += content_in_doc
content_in_doc_SOURCES = content_in_doc.cc
content_in_doc_CPPFLAGS = $(AM_CPPFLAGS) \
-I/home/lazzara/git/oln/scribo/sandbox/green/ \
-I/home/lazzara/git/oln/scribo/sandbox/z/ \
$(TESSERACT_CPPFLAGS) \
$(TIFF_CPPFLAGS) \
$(MAGICKXX_CPPFLAGS)
......
......@@ -26,6 +26,8 @@
#include <mln/io/ppm/load.hh>
#include <mln/io/pbm/save.hh>
#include <mln/data/transform.hh>
#include <mln/fun/v2v/rgb_to_int_u.hh>
#include <scribo/binarization/sauvola.hh>
#include <scribo/debug/usage.hh>
......@@ -66,10 +68,16 @@ int main(int argc, char *argv[])
std::cout << "Using w=" << w << " and k=" << k << std::endl;
// Load
image2d<value::rgb8> input;
io::ppm::load(input, argv[1]);
image2d<bool> out = scribo::binarization::sauvola(input, w, k);
// Convert to Gray level image.
image2d<value::int_u8>
input_gl = data::transform(input, mln::fun::v2v::rgb_to_int_u<8>());
// Binarize
image2d<bool> out = scribo::binarization::sauvola(input_gl, w, k);
io::pbm::save(out, argv[2]);
......
......@@ -28,6 +28,8 @@
#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_int_u.hh>
#include <scribo/binarization/sauvola_ms.hh>
#include <scribo/debug/usage.hh>
......@@ -99,6 +101,9 @@ int main(int argc, char *argv[])
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]);
......
......@@ -24,10 +24,14 @@
// 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_int_u.hh>
#include <scribo/binarization/sauvola_ms.hh>
#include <scribo/preprocessing/split_bg_fg.hh>
......@@ -103,6 +107,8 @@ int main(int argc, char *argv[])
else
k = 0.34f;
std::cout << "Using w_1=" << w_1 << " - s=" << s
<< " - k=" << k << std::endl;
// Load
image2d<value::rgb8> input_1;
......
......@@ -28,6 +28,8 @@
#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_int_u.hh>
#include <scribo/binarization/sauvola_ms_split.hh>
#include <scribo/debug/usage.hh>
......@@ -113,11 +115,13 @@ int main(int argc, char *argv[])
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;
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);
output = scribo::binarization::sauvola_ms_split(input_1, w_1, s,
min_ntrue, k);
io::pbm::save(output, argv[2]);
}
......
......@@ -24,6 +24,8 @@
// 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/int_u8.hh>
#include <mln/io/magick/load.hh>
......@@ -102,6 +104,9 @@ int main(int argc, char *argv[])
else
k = 0.34f;
std::cout << "Using w_1=" << w_1 << " - s=" << s
<< " - k=" << k << std::endl;
// Load
image2d<value::rgb8> input_1;
io::magick::load(input_1, argv[1]);
......
......@@ -24,10 +24,14 @@
// 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/magick/load.hh>
#include <mln/io/pbm/save.hh>
#include <mln/data/transform.hh>
#include <mln/fun/v2v/rgb_to_int_u.hh>
#include <scribo/binarization/sauvola_ms.hh>
#include <scribo/preprocessing/split_bg_fg.hh>
......@@ -86,6 +90,8 @@ int main(int argc, char *argv[])
unsigned s = atoi(argv[4]);
std::cout << "Using w_1=" << w_1 << " - s=" << s << std::endl;
// Load
image2d<value::rgb8> input_1;
io::magick::load(input_1, argv[1]);
......
......@@ -107,7 +107,8 @@ int main(int argc, char *argv[])
else
k = 0.34f;
std::cout << "Using w_1=" << w_1 << " - s=" << s
<< " - k=" << k << std::endl;
image2d<value::rgb8> input_1;
io::magick::load(input_1, argv[1]);
......
......@@ -29,6 +29,8 @@
#include <mln/io/pgm/load.hh>
#include <mln/io/ppm/load.hh>
#include <mln/io/pbm/save.hh>
#include <mln/data/transform.hh>
#include <mln/fun/v2v/rgb_to_int_u.hh>
#include <scribo/binarization/sauvola_ms.hh>
#include <scribo/postprocessing/fill_object_holes.hh>
......
......@@ -40,6 +40,7 @@
#include <scribo/toolchain/text_in_doc.hh>
#include <scribo/core/document.hh>
#include <scribo/core/line_set.hh>
#include <scribo/debug/usage.hh>
......@@ -91,11 +92,11 @@ int main(int argc, char* argv[])
trace::entering("main");
typedef image2d<scribo::def::lbl_type> L;
image2d<bool> input;
mln::io::pbm::load(input, argv[1]);
// Optional Cropping
point2d crop_shift = literal::origin;
if (argc >= 8)
......@@ -119,12 +120,15 @@ int main(int argc, char* argv[])
// Run document toolchain.
typedef image2d<scribo::def::lbl_type> L;
line_set<L>
lines = scribo::toolchain::text_in_doc(input, denoise, debug);
scribo::document<L> doc;
doc.set_filename(argv[1]);
doc.set_text(lines);
// Saving results
scribo::io::xml::save(argv[1], lines, "out.xml", true);
scribo::io::xml::save(doc, "out.xml", true);
// Specify shift due to potential previous crop.
scribo::io::text_boxes::save(lines, argv[2], crop_shift);
......
......@@ -28,33 +28,20 @@
#include <iostream>
#include <mln/core/image/image2d.hh>
#include <mln/core/image/imorph/tr_image.hh>
#include <mln/core/alias/neighb2d.hh>
#include <mln/labeling/colorize.hh>
#include <mln/data/stretch.hh>
#include <mln/io/pbm/all.hh>
#include <mln/io/ppm/save.hh>
#include <mln/io/magick/all.hh>
#include <mln/math/min.hh>
#include <mln/logical/not.hh>
#include <mln/literal/colors.hh>
#include <mln/value/rgb8.hh>
#include <mln/value/label_16.hh>
#include <mln/fun/v2v/rgb_to_int_u.hh>
#include <mln/data/wrap.hh>
#include <mln/draw/box.hh>
#include <mln/geom/translate.hh>
#include <mln/subsampling/antialiased.hh>
#include <scribo/draw/bounding_boxes.hh>
......@@ -81,8 +68,6 @@
#include <scribo/filter/object_links_bbox_h_ratio.hh>
#include <scribo/filter/object_links_bbox_overlap.hh>
#include <scribo/filter/common/objects_photo.hh>
#include <scribo/filter/object_groups_small.hh>
#include <scribo/filter/object_groups_v_thickness.hh>
......
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