last-svn-commit-31-gba99cc2 Test on image database the achromatism descriptor.

* green/exp/annotating/achromatism/Makefile.am: New Makefile. * green/exp/annotating/achromatism/achromatism.am: New source. * green/exp/annotating/achromatism/text-color.txt: New image class. * green/exp/annotating/achromatism/text-img.txt: New image class. * green/exp/annotating/achromatism/text-only.txt: New image class. --- milena/sandbox/ChangeLog | 18 +++ .../{nb_color => achromastism}/Makefile.am | 4 +- .../exp/annotating/achromastism/achromastism.cc | 113 ++++++++++++++++++++ .../exp/annotating/achromastism/text-color.txt | 15 +++ .../green/exp/annotating/achromastism/text-img.txt | 40 +++++++ .../exp/annotating/achromastism/text-only.txt | 8 ++ 6 files changed, 197 insertions(+), 1 deletions(-) copy milena/sandbox/green/exp/annotating/{nb_color => achromastism}/Makefile.am (96%) create mode 100644 milena/sandbox/green/exp/annotating/achromastism/achromastism.cc create mode 100644 milena/sandbox/green/exp/annotating/achromastism/text-color.txt create mode 100644 milena/sandbox/green/exp/annotating/achromastism/text-img.txt create mode 100644 milena/sandbox/green/exp/annotating/achromastism/text-only.txt diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog index 27c37db..d86642a 100644 --- a/milena/sandbox/ChangeLog +++ b/milena/sandbox/ChangeLog @@ -1,3 +1,21 @@ +2010-06-21 Yann Jacquelet <jacquelet@lrde.epita.fr> + + Test on image database the achromatism descriptor. + + * green/exp/annotating/achromatism/Makefile.am: New Makefile. + * green/exp/annotating/achromatism/achromatism.am: New source. + * green/exp/annotating/achromatism/text-color.txt: New image class. + * green/exp/annotating/achromatism/text-img.txt: New image class. + * green/exp/annotating/achromatism/text-only.txt: New image class. + +2010-06-21 Yann Jacquelet <jacquelet@lrde.epita.fr> + + Turn around Millet 2008 hsv descriptors. + + * green/demo/annotating/hsv: New directory. + * green/demo/annotating/hsv/Makefile.am: New Makefile. + + 2010-02-10 Yann Jacquelet <jacquelet@lrde.epita.fr> Save Theo's exhaustive demonstration results. diff --git a/milena/sandbox/green/exp/annotating/nb_color/Makefile.am b/milena/sandbox/green/exp/annotating/achromastism/Makefile.am similarity index 96% copy from milena/sandbox/green/exp/annotating/nb_color/Makefile.am copy to milena/sandbox/green/exp/annotating/achromastism/Makefile.am index 8e204c6..d33b94d 100644 --- a/milena/sandbox/green/exp/annotating/nb_color/Makefile.am +++ b/milena/sandbox/green/exp/annotating/achromastism/Makefile.am @@ -7,7 +7,9 @@ ######### LOADLIBES= -lboost_filesystem -INCLUDES= -I$(HOME)/svn/oln/trunk/milena/sandbox/green +INCLUDES1= -I$(HOME)/git/olena/milena/sandbox/green +INCLUDES2= -I$(HOME)/git/olena/milena +INCLUDES= $(INCLUDES1) $(INCLUDES2) #CXXFLAGS= -ggdb -O0 -Wall -W -pedantic -ansi -pipe $(INCLUDES) #CXXFLAGS= -DNDEBUG -O1 -Wall -W -pedantic -ansi -pipe $(INCLUDES) CXXFLAGS= -DNDEBUG -O3 -Wall -W -pedantic -ansi -pipe $(INCLUDES) diff --git a/milena/sandbox/green/exp/annotating/achromastism/achromastism.cc b/milena/sandbox/green/exp/annotating/achromastism/achromastism.cc new file mode 100644 index 0000000..fdb8e6d --- /dev/null +++ b/milena/sandbox/green/exp/annotating/achromastism/achromastism.cc @@ -0,0 +1,113 @@ +// ACHROMATISM TEST CF MILLET 2008 + +#include <iostream> +#include <sstream> +#include <boost/filesystem.hpp> + +#include <mln/img_path.hh> + +#include <mln/accu/stat/histo1d.hh> + +#include <mln/core/image/image1d.hh> +#include <mln/core/image/image2d.hh> +#include <mln/core/image/dmorph/image_if.hh> + +#include <mln/data/compute.hh> +#include <mln/data/stretch.hh> +#include <mln/data/transform.hh> + +#include <mln/math/max.hh> +#include <mln/math/min.hh> + +#include <mln/geom/nsites.hh> + +#include <mln/fun/v2v/rgb_to_achromatism_map.hh> + +#include <mln/io/ppm/load.hh> +#include <mln/io/plot/save_image_sh.hh> + +#include <mln/value/rgb8.hh> + +template <typename I> +unsigned count_histo(const mln::Image<I>& img_) +{ + const I& img = exact(img_); + + mln_precondition(img.is_valid()); + + unsigned result = 0; + + mln_piter(I) p(img.domain()); + + for_all(p) + result += img(p); + + return result; +} + +float achromatism_test(const std::string input, + const std::string output, + const unsigned threshold) + +{ + typedef mln::fun::v2v::rgb_to_achromatism_map<8> t_rgb_to_achromatism_map; + + mln::image2d<mln::value::rgb8> input_rgb8; + mln::image2d<mln::value::int_u8> map; + mln::image1d<unsigned> histo; + unsigned cnt1; + unsigned cnt2; + float prop; + + mln::io::ppm::load(input_rgb8, input.c_str()); + + map = mln::data::transform(input_rgb8, t_rgb_to_achromatism_map()); + histo = mln::data::compute(mln::accu::meta::stat::histo1d(), map); + cnt1 = count_histo(histo | mln::box1d(mln::point1d(0), + mln::point1d(threshold))); + cnt2 = mln::geom::nsites(input_rgb8); + prop = ((100.0 * cnt1) / cnt2); + + mln::io::plot::save_image_sh(histo, output.c_str()); + + return prop; +} + + +int main() +{ + typedef boost::filesystem::path t_path; + typedef boost::filesystem::directory_iterator t_iter_path; + + t_path full_path[] = {t_path(ICDAR_20P_PPM_IMG_PATH)}; + + for (int i = 0; i < 1; ++i) + { + std::cout << "entering " << full_path[i] << std::endl; + + if (boost::filesystem::exists(full_path[i]) && + boost::filesystem::is_directory(full_path[i])) + { + boost::filesystem::system_complete(full_path[i]); + const t_iter_path end_iter; + float prop = 0.0; + + for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter) + { + // concatenation de chaine + t_path directory(ANNOTATING_ACHROMATISM_RET_PATH); + t_path leaf = dir_iter->path().leaf(); + t_path output = change_extension(directory / leaf, ".sh"); + + prop = achromatism_test(dir_iter->path().string(), + output.string(), + 11); + + std::cout << output << " : " << prop << std::endl; + std::cerr << output << " : " << prop << std::endl; + } + } + } + + return 0; +} diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-color.txt b/milena/sandbox/green/exp/annotating/achromastism/text-color.txt new file mode 100644 index 0000000..4dfcbd3 --- /dev/null +++ b/milena/sandbox/green/exp/annotating/achromastism/text-color.txt @@ -0,0 +1,15 @@ +mp00262c_20p.ppm +mp00263c_20p.ppm +mp00319c_20p.ppm +mp00440c_20p.ppm +mp00608c_20p.ppm +mp00630c_20p.ppm +mp00631c_20p.ppm +ta00028c_20p.ppm +ta00037c_20p.ppm +ta00043c_20p.ppm +ta00046c_20p.ppm +ta00073c_20p.ppm +ta00081c_20p.ppm +ta00089c_20p.ppm +ta00090c_20p.ppm diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-img.txt b/milena/sandbox/green/exp/annotating/achromastism/text-img.txt new file mode 100644 index 0000000..4ecb7ca --- /dev/null +++ b/milena/sandbox/green/exp/annotating/achromastism/text-img.txt @@ -0,0 +1,40 @@ +mp00032c_20p.ppm +mp00042c_20p.ppm +mp00076c_20p.ppm +mp00082c_20p.ppm +mp00142c_20p.ppm +mp00215c_20p.ppm +mp00228c_20p.ppm +mp00234c_20p.ppm +mp00248c_20p.ppm +mp00252c_20p.ppm +mp00253c_20p.ppm +mp00255c_20p.ppm +mp00259c_20p.ppm +mp00271c_20p.ppm +mp00290c_20p.ppm +mp00293c_20p.ppm +mp00304c_20p.ppm +mp00307c_20p.ppm +mp00311c_20p.ppm +mp00376c_20p.ppm +mp00411c_20p.ppm +mp00419c_20p.ppm +mp00447c_20p.ppm +mp00498c_20p.ppm +mp00510c_20p.ppm +mp00550c_20p.ppm +mp00573c_20p.ppm +mp00589c_20p.ppm +mp00592c_20p.ppm +mp00597c_20p.ppm +mp00599c_20p.ppm +mp00600c_20p.ppm +ta00031c_20p.ppm +ta00034c_20p.ppm +ta00063c_20p.ppm +ta00065c_20p.ppm +ta00072c_20p.ppm +ta00081c_20p.ppm +ta00083c_20p.ppm + diff --git a/milena/sandbox/green/exp/annotating/achromastism/text-only.txt b/milena/sandbox/green/exp/annotating/achromastism/text-only.txt new file mode 100644 index 0000000..0218a2a --- /dev/null +++ b/milena/sandbox/green/exp/annotating/achromastism/text-only.txt @@ -0,0 +1,8 @@ +mp00329c_20p.ppm +ta00036c_20p.ppm +ta00039c_20p.ppm +ta00040c_20p.ppm +ta00049c_20p.ppm +ta00055c_20p.ppm +ta00057c_20p.ppm +ta00068c_20p.ppm -- 1.5.6.5
participants (1)
-
Yann Jacquelet