milena r1658: Clean input image for extract character

URL: https://svn.lrde.epita.fr/svn/oln/trunk/milena ChangeLog: 2008-01-14 Guillaume Duhamel <guillaume.duhamel@lrde.epita.fr> Clean input image for extract character. * sandbox/nivault/extract_character.cc: Remove noise on input image. --- extract_character.cc | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) Index: trunk/milena/sandbox/nivault/extract_character.cc =================================================================== --- trunk/milena/sandbox/nivault/extract_character.cc (revision 1657) +++ trunk/milena/sandbox/nivault/extract_character.cc (revision 1658) @@ -68,6 +68,7 @@ # include <mln/level/paste.hh> # include <mln/literal/all.hh> # include <mln/value/rgb8.hh> +# include <mln/morpho/opening_area.hh> using namespace mln; @@ -272,10 +273,18 @@ /// Inversion video. morpho::complementation_inplace(input); + /// Clean input image (remove noise with area opening) + image2d<bool> input2 (input.domain()); + morpho::opening_area(input, c4(), 5, input2); + +// image2d<int_u8> process (input.domain ()); +// level::stretch (output_2, process); +// io::pgm::save(process, "process.pgm"); + /// Labeling the input image. unsigned nb_labels; - I_LABEL label_image = labeling::blobs(input, c8(), nb_labels); + I_LABEL label_image = labeling::blobs(input2, c8(), nb_labels); std::cout << "nb_labels = " << nb_labels << std::endl; /// Extraction of informations in the image (BoundingBox, Cardinality, ... ). @@ -377,10 +386,5 @@ io::ppm::save(output, path_output + ".ppm"); std::cout << path_output + ".ppm" << " generated" << std::endl; - -// image2d<int_u8> process (label_image.domain ()); -// level::stretch (label_image2, process); -// io::pgm::save(process, "process.pgm"); - }
participants (1)
-
Guillaume Duhamel