Olena-patches
Threads by month
- ----- 2025 -----
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
February 2010
- 6 participants
- 91 discussions

last-svn-commit-22-gf628029 Write the opening volume thresholds for the scribo image mp00082c.ppm.
by green 24 Feb '10
by green 24 Feb '10
24 Feb '10
* green/demo/labeling/regional_maxima/thresholds.txt: New documentation.
---
milena/sandbox/ChangeLog | 6 ++++
.../demo/labeling/regional_maxima/thresholds.txt | 27 ++++++++++++++++++++
2 files changed, 33 insertions(+), 0 deletions(-)
create mode 100644 milena/sandbox/green/demo/labeling/regional_maxima/thresholds.txt
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 48be011..0947048 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,11 @@
2009-12-23 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Write the opening volume thresholds for the scribo image mp00082c.ppm.
+
+ * green/demo/labeling/regional_maxima/thresholds.txt: New documentation.
+
+2009-12-23 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Experiment various quantifications on regional maxima labeling.
* green/doc/regional_maxima/cmp_quant/h0_input.pgm.gz: New histogram.
diff --git a/milena/sandbox/green/demo/labeling/regional_maxima/thresholds.txt b/milena/sandbox/green/demo/labeling/regional_maxima/thresholds.txt
new file mode 100644
index 0000000..ddf5ca7
--- /dev/null
+++ b/milena/sandbox/green/demo/labeling/regional_maxima/thresholds.txt
@@ -0,0 +1,27 @@
+image = 1169 x 1567 = 1831823
+
+
+% image | min_volume
+-----------------------
+ 0.05 % | 1000.00
+ 1.00 % | 18318.23
+ 5.00 % | 91591.15
+ 10.00 % | 183182.30
+ 15.00 % | 274773.45
+ 20.00 % | 366364.60
+ 25.00 % | 457955.75
+ 30.00 % | 549546.90
+ 35.00 % | 641138.05
+ 40.00 % | 732729.20
+ 45.00 % | 824320.35
+ 50.00 % | 915911.50
+ 55.00 % | 1007502.65
+ 60.00 % | 1099093.80
+ 65.00 % | 1190684.95
+ 70.00 % | 1282276.10
+ 75.00 % | 1373867.25
+ 80.00 % | 1465458.40
+ 85.00 % | 1557049.55
+ 90.00 % | 1648640.70
+ 95.00 % | 1740231.85
+100.00 % | 1831823.00
--
1.5.6.5
1
0

24 Feb '10
* green/demo/labeling/regional_maxima/regional_maxima.cc: Add
many modifications to reach the current software state. There is some
nomenclatura, some refactoring and debugging.
---
milena/sandbox/ChangeLog | 8 +
.../labeling/regional_maxima/regional_maxima.cc | 354 ++++++++++++--------
2 files changed, 214 insertions(+), 148 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index f850e69..3a7ffb7 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-18 Yann Jacquelet<jacquelet(a)lrde.epita.fr>
+
+ Fix the right behaviour of the regmax software.
+
+ * green/demo/labeling/regional_maxima/regional_maxima.cc: Add
+ many modifications to reach the current software state. There is some
+ nomenclatura, some refactoring and debugging.
+
2009-12-17 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Fix bug in the direction of projection.
diff --git a/milena/sandbox/green/demo/labeling/regional_maxima/regional_maxima.cc b/milena/sandbox/green/demo/labeling/regional_maxima/regional_maxima.cc
index c832486..65b6608 100644
--- a/milena/sandbox/green/demo/labeling/regional_maxima/regional_maxima.cc
+++ b/milena/sandbox/green/demo/labeling/regional_maxima/regional_maxima.cc
@@ -27,7 +27,8 @@
// #include <mln/data/stretch.hh>
#include <mln/data/transform.hh>
-// #include <mln/display/display_histo.hh>
+// #include <mln/debug/println.hh>
+#include <mln/display/display_histo.hh>
#include <mln/fun/v2v/rgb8_to_rgbn.hh>
@@ -49,6 +50,7 @@
#include <mln/opt/at.hh>
+#include <mln/transform/influence_zone_geodesic.hh>
// #include <mln/pw/value.hh>
#include <mln/util/array.hh>
@@ -255,108 +257,6 @@ void print_count2(const mln::image2d<mln::value::rgb<n> >& input_rgbn,
}
}
-template <unsigned n>
-mln::image2d<mln::value::label_8>
-compute_stats(const mln::image2d<mln::value::rgb8>& input_rgb8,
- const mln::image2d<mln::value::rgb<n> >& input_rgbn,
- const mln::image3d<unsigned>& histo,
- const mln::image3d<mln::value::label_8>& label,
- const unsigned n_labels)
-{
- typedef mln::value::label_8 t_lbl8;
- typedef mln::value::rgb<n> t_rgbn;
- typedef mln::value::rgb8 t_rgb8;
- typedef mln::value::int_u<n> t_int_un;
- typedef mln::algebra::vec<3,float> t_vec3f;
- typedef mln::accu::math::sum<unsigned,unsigned> t_sum;
- typedef mln::accu::stat::mean<t_vec3f,t_vec3f,t_vec3f> t_mean;
- typedef mln::image2d<t_lbl8> t_image2d_lbl8;
- typedef mln::image2d<t_rgbn> t_image2d_rgbn;
- typedef mln::image2d<t_rgb8> t_image2d_rgb8;
- typedef mln::image2d<t_int_un> t_image2d_int_un;
- typedef mln::util::array<unsigned> t_count_array;
- typedef mln::util::array<t_vec3f> t_mean_array;
-
- mln::util::array<float> abs((unsigned)(n_labels)+1);
- mln::util::array<float> rel((unsigned)(n_labels)+1);
- unsigned nb = 0;
-
- for (unsigned i = 0; i <= n_labels; ++i)
- {
- abs[i] = 0.0;
- rel[i] = 0.0;
- }
-
- // COMPUTE THE SUM
- t_count_array count = mln::labeling::compute(t_sum(),
- histo,
- label,
- n_labels);
-
- // COMPUTE THE TOTAL
- for (unsigned i = 0; i <= n_labels; ++i)
- {
- unsigned c = count[i];
- nb += c;
- }
-
- // COMPUTE THE PERCENTAGES
- for (unsigned i = 0; i <= n_labels; ++i)
- if (0 < count[i])
- {
- abs[i] = ((float)count[i] / nb)*100.0;
- rel[i] = ((float)count[i] / (nb - count[0]))*100.0;
- }
-
- // COMPUTE THE MEAN
- t_image2d_lbl8 label_img = mln::data::transform(input_rgbn,
- t_labeling_rgbn<n>(label));
-
- t_mean_array mean = mln::labeling::compute(t_mean(),
- input_rgb8,
- label_img,
- n_labels);
-
- // CORRECT LABEL 0 STATS
- rel[0] = 0;
- mean[0][0] = 255.0;
- mean[0][1] = 255.0;
- mean[0][2] = 0.0;
-
- for (unsigned i = 0; i <= n_labels; ++i)
- {
- const t_vec3f& mean_v = mean[i];
-
- std::cout << boost::format("%2i|"
- "r = %6.2f, g = %6.2f, b = %6.2f |"
- "c = %7i, %%i = %5.2f, %%c = %5.2f")
- % i
- % mean_v[0]
- % mean_v[1]
- % mean_v[2]
- % count[i]
- % abs[i]
- % rel[i]
- << std::endl;
- /*
- std::cout << i << "|("
- << "r = " << unquant<n>(mean_v[0]) << ", "
- << "g = " << unquant<n>(mean_v[1]) << ", "
- << "b = " << unquant<n>(mean_v[2]) << ")|("
- << "c = " << count[i] << ", "
- << "%i= " << abs[i] << "%, "
- << "%c= " << rel[i] << "%)"
- << std::endl;
- */
- }
-
- t_image2d_rgb8 mean_rgb8 = mln::data::transform(label_img,
- t_mean_lbl8_with_rgb8(mean));
-
- mln::io::ppm::save(mean_rgb8, "mean.ppm");
-
- return label_img;
-}
void print_count(const mln::image3d<unsigned>& histo,
const mln::image3d<mln::value::label_8>& label,
@@ -561,9 +461,111 @@ int main2()
return 0;
}
+void compute_stats(const mln::image2d<mln::value::rgb8>& i_input_rgb8,
+ const mln::image2d<mln::value::label_8>& l_input_lbl8,
+ const mln::image3d<unsigned>& h_histo_rgbn,
+ const mln::image3d<mln::value::label_8>& l_histo_lbl8,
+ const mln::value::label_8& n_labels)
+{
+ typedef mln::algebra::vec<3,float> t_vec3f;
+ typedef mln::accu::math::sum<unsigned,unsigned> t_sum;
+ typedef mln::accu::stat::mean<t_vec3f,t_vec3f,t_vec3f> t_mean;
+ typedef mln::util::array<unsigned> t_count_array;
+ typedef mln::util::array<t_vec3f> t_mean_array;
+
+ mln::util::array<float> abs((unsigned)(n_labels)+1);
+ mln::util::array<float> rel((unsigned)(n_labels)+1);
+ unsigned nb = 0;
+
+ for (unsigned i = 0; i <= n_labels; ++i)
+ {
+ abs[i] = 0.0;
+ rel[i] = 0.0;
+ }
+
+ // COMPUTE THE SUM
+ t_count_array count = mln::labeling::compute(t_sum(),
+ h_histo_rgbn,
+ l_histo_lbl8,
+ n_labels);
+
+ // COMPUTE THE TOTAL
+ for (unsigned i = 0; i <= n_labels; ++i)
+ {
+ unsigned c = count[i];
+ nb += c;
+ }
+
+ // COMPUTE THE PERCENTAGES
+ for (unsigned i = 0; i <= n_labels; ++i)
+ if (0 < count[i])
+ {
+ abs[i] = ((float)count[i] / nb)*100.0;
+ rel[i] = ((float)count[i] / (nb - count[0]))*100.0;
+ }
+
+ // COMPUTE THE MEAN
+
+ t_mean_array mean = mln::labeling::compute(t_mean(),
+ i_input_rgb8,
+ l_input_lbl8,
+ n_labels);
+
+ // CORRECT 0 LABEL STATS
+ rel[0] = 0;
+ mean[0][0] = 255.0;
+ mean[0][1] = 255.0;
+ mean[0][2] = 0.0;
+
+ // PRINT STATS
+ for (unsigned i = 0; i <= n_labels; ++i)
+ {
+ const t_vec3f& mean_v = mean[i];
+
+ std::cout << boost::format("%2i|"
+ "r = %6.2f, g = %6.2f, b = %6.2f |"
+ "c = %7i, %%i = %5.2f, %%c = %5.2f")
+ % i
+ % mean_v[0]
+ % mean_v[1]
+ % mean_v[2]
+ % count[i]
+ % abs[i]
+ % rel[i]
+ << std::endl;
+ /*
+ std::cout << i << "|("
+ << "r = " << unquant<n>(mean_v[0]) << ", "
+ << "g = " << unquant<n>(mean_v[1]) << ", "
+ << "b = " << unquant<n>(mean_v[2]) << ")|("
+ << "c = " << count[i] << ", "
+ << "%i= " << abs[i] << "%, "
+ << "%c= " << rel[i] << "%)"
+ << std::endl;
+ */
+ }
+
+ std::cout << std::endl << std::endl;
+
+}
+
+void save_histo(const mln::image2d<mln::value::rgb8>& input_rgb8,
+ const std::string& name)
+{
+ typedef mln::value::int_u8 t_int_u8;
+ typedef mln::image2d<t_int_u8> t_image2d_int_u8;
+ typedef mln::image3d<unsigned> t_histo3d;
+ typedef mln::accu::meta::stat::histo3d_rgb t_histo3d_fun;
+
+ t_histo3d histo = mln::data::compute(t_histo3d_fun(), input_rgb8);
+ t_image2d_int_u8 display = mln::display::display_histo3d_unsigned(histo);
+ mln::io::pgm::save(display, name);
+}
+
+
// n < 8, n is the degree of quantification
template <unsigned n>
-void demo(const std::string& image, const unsigned min_volume)
+void demo(const std::string& image, const unsigned min_vol)
{
typedef mln::value::label_8 t_lbl8;
typedef mln::value::int_u8 t_int_u8;
@@ -580,45 +582,106 @@ void demo(const std::string& image, const unsigned min_volume)
typedef mln::accu::meta::stat::histo3d_rgb t_histo3d_fun;
// START OF IMAGE PROCESSING CHAIN
- t_image2d_rgb8 input_rgb8;
- t_image2d_rgbn input_rgbn;
- t_image2d_rgb8 output_rgb8;
- t_image2d_rgb8 mean_rgb8;
- t_histo3d histo;
- t_histo3d histo2;
- // t_image2d_int_u8 projected;
- // t_image2d_int_u8 filtered;
- t_histo3d opened;
- t_image3d_lbl8 label;
- t_image2d_lbl8 label_img;
- t_image3d_lbl8 dilated;
- t_lbl8 n_labels;
-
- mln::io::ppm::load(input_rgb8, image.c_str());
- input_rgbn = mln::data::transform(input_rgb8, t_rgb8_to_rgbn());
- histo = mln::data::compute(t_histo3d_fun(), input_rgbn);
- opened = mln::morpho::opening::volume(histo, mln::c6(), min_volume);
- label = mln::labeling::regional_maxima(opened, mln::c6(), n_labels);
- // dilated = mln::morpho::elementary::dilation(label, mln::c26());
+ t_image2d_rgb8 i0_input; // input rgb8
+ t_histo3d h0_input; // histo input
+
+ t_image2d_rgbn i1_input; // input rgbn
+ t_histo3d h1_input; // histo input
+
+ t_histo3d h2_input; // histo opened
+ t_image3d_lbl8 l2_histo; // label histo
+ t_image2d_lbl8 l2_input; // label image
+ t_image2d_rgb8 i2_merge; // merge label
+ t_image2d_rgb8 i2_mean; // mean label
+
+ t_image3d_lbl8 l3_histo; // label dilated
+ t_image2d_lbl8 l3_input; // label image
+ t_image2d_rgb8 i3_merge; // merge label
+ t_image2d_rgb8 i3_mean; // mean label
+
+ t_image3d_lbl8 l4_histo; // label iz
+ t_image2d_lbl8 l4_input; // label image
+ t_image2d_rgb8 i4_merge; // merge label
+ t_image2d_rgb8 i4_mean; // mean label
+
+ t_image3d_lbl8 l5_histo; // label iz 2
+ t_image2d_lbl8 l5_input; // label image
+ t_image2d_rgb8 i5_merge; // merge label
+ t_image2d_rgb8 i5_mean; // mean label
+
+ t_lbl8 n_lbl; // nb class
+
+ mln::io::ppm::load(i0_input, image.c_str());
+ i1_input = mln::data::transform(i0_input, t_rgb8_to_rgbn());
+ h1_input = mln::data::compute(t_histo3d_fun(), i1_input);
+ h2_input = mln::morpho::opening::volume(h1_input, mln::c6(), min_vol);
+ l2_histo = mln::labeling::regional_maxima(h2_input, mln::c6(), n_lbl);
+ l3_histo = mln::morpho::elementary::dilation(l2_histo, mln::c26());
+ l4_histo = mln::transform::influence_zone_geodesic(l2_histo, mln::c26());
+ l5_histo = mln::transform::influence_zone_geodesic(l2_histo, mln::c26(), 2);
// END OF IMAGE PROCESSING CHAIN
+// i2_mean = mln::data::transform(l0_input,t_mean_lbl8_with_rgb8(mean_array));
// BEGIN DUMPING
- label_img = compute_stats(input_rgb8, input_rgbn, histo, label, n_labels);
- // mean_rgb8 = mln::labeling::mean_values(input_rgb8, label_img, n_labels);
- // mln::io::ppm::save(mean_rgb8, "mean.ppm");
+ save_histo(i0_input, "h0_input.pgm");
+
+ // without anything
+ l2_input = mln::data::transform(i1_input, t_labeling_rgbn<n>(l2_histo));
+ i2_mean = mln::labeling::mean_values(i0_input, l2_input, n_lbl);
+ i2_merge = mln::data::transform(i0_input,t_merge_lbl8_with_rgbn<n>(l2_histo));
+
+ compute_stats(i0_input, l2_input, h1_input, l2_histo, n_lbl);
+
+ mln::io::pgm::save(l2_input, "l2_input.pgm");
+ mln::io::ppm::save(i2_mean, "i2_mean.ppm");
+ mln::io::ppm::save(i2_merge, "i2_merge.ppm");
+
+ save_histo(i2_mean, "h2_mean.pgm");
+ save_histo(i2_merge, "h2_merge.pgm");
- output_rgb8 = mln::data::transform(input_rgb8,
- t_merge_lbl8_with_rgbn<5>(label));
+ // with dilation
+ l3_input = mln::data::transform(i1_input, t_labeling_rgbn<n>(l3_histo));
+ i3_mean = mln::labeling::mean_values(i0_input, l3_input, n_lbl);
+ i3_merge = mln::data::transform(i0_input,t_merge_lbl8_with_rgbn<n>(l3_histo));
+ compute_stats(i0_input, l3_input, h1_input, l3_histo, n_lbl);
- mln::io::ppm::save(output_rgb8, "merge.ppm");
- mln::io::pgm::save(label_img, "label.pgm");
+ mln::io::pgm::save(l3_input, "l3_input.pgm");
+ mln::io::ppm::save(i3_mean, "i3_mean.ppm");
+ mln::io::ppm::save(i3_merge, "i3_merge.ppm");
+ save_histo(i3_mean, "h3_mean.pgm");
+ save_histo(i3_merge, "h3_merge.pgm");
-// histo2 = mln::data::compute(t_histo3d_fun(), mean_rgbn);
-// mln::debug::println(histo2);
+ // with geodesic influence
+ l4_input = mln::data::transform(i1_input, t_labeling_rgbn<n>(l4_histo));
+ i4_mean = mln::labeling::mean_values(i0_input, l4_input, n_lbl);
+ i4_merge = mln::data::transform(i0_input,t_merge_lbl8_with_rgbn<n>(l4_histo));
+
+ compute_stats(i0_input, l4_input, h1_input, l4_histo, n_lbl);
+
+ mln::io::pgm::save(l4_input, "l4_input.pgm");
+ mln::io::ppm::save(i4_mean, "i4_mean.ppm");
+ mln::io::ppm::save(i4_merge, "i4_merge.ppm");
+
+ save_histo(i4_mean, "h4_mean.pgm");
+ save_histo(i4_merge, "h4_merge.pgm");
+
+ // with restricted geodesic influence
+ l5_input = mln::data::transform(i1_input, t_labeling_rgbn<n>(l5_histo));
+ i5_mean = mln::labeling::mean_values(i0_input, l5_input, n_lbl);
+ i5_merge = mln::data::transform(i0_input,t_merge_lbl8_with_rgbn<n>(l5_histo));
+
+ compute_stats(i0_input, l5_input, h1_input, l5_histo, n_lbl);
+
+ mln::io::pgm::save(l5_input, "l5_input.pgm");
+ mln::io::ppm::save(i5_mean, "i5_mean.ppm");
+ mln::io::ppm::save(i5_merge, "i5_merge.ppm");
+
+ save_histo(i5_mean, "h5_mean.pgm");
+ save_histo(i5_merge, "h5_merge.pgm");
// END DUMPING
/*
@@ -685,25 +748,14 @@ void demo(const std::string& image, const unsigned min_volume)
*/
}
-/*
-int main_old()
-{
- demo<2>(); // 2.26 s
- demo<3>(); // 2.29 s
- demo<4>(); // 2.29 s
- demo<5>(); // 2.37 s
- demo<6>(); // 3.19 s
- demo<7>(); // 11.43 s
- demo<8>(); // 96.19 s
-}
-*/
+
void usage()
{
std::cout << std::endl;
std::cout << "regional_maxima" << std::endl;
std::cout << "image <name>" << std::endl;
std::cout << "quantification {5,6}" << std::endl;
- std::cout << "volume 1000" << std::endl;
+ std::cout << "min_volume 1000" << std::endl;
// 3 paramètres en entré:
// * l'image
@@ -712,8 +764,14 @@ void usage()
// sorties:
// * fichier de stats [etiquette|couleur moyenne|% image|% classé]
- // * couleur moyenne de l'étiquette + couleur specifique pour étiquette 0
- // * histo sur l'image d'étiquette
+ // * image de labels
+ // * image reconstruite avec la moyenne de chaque classe [i_mean]
+ // * image reconstruite avec les couleurs de chaque classe [i_merge]
+ // * histogramme original de l'image d'entrée [h_input]
+ // * histogramme projeté de mean [h_mean]
+ // * histogramme projeté de merge [h_merge]
+
+ // *
}
int main(int argc, char* args[])
--
1.5.6.5
1
0
* green/mln/display/display_histo.hh: Fix bug in the direction.
* green/mln/display/project_histo.hh: Add spaces to follow the LRDE
norm.
---
milena/sandbox/ChangeLog | 8 ++++++++
milena/sandbox/green/mln/display/display_histo.hh | 13 +++++++++----
milena/sandbox/green/mln/display/project_histo.hh | 4 ++--
3 files changed, 19 insertions(+), 6 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index b180063..f850e69 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,11 @@
+2009-12-17 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Fix bug in the direction of projection.
+
+ * green/mln/display/display_histo.hh: Fix bug in the direction.
+ * green/mln/display/project_histo.hh: Add spaces to follow the LRDE
+ norm.
+
2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Fix bugs in regional_maxima routine, work with rgb8 for stats.
diff --git a/milena/sandbox/green/mln/display/display_histo.hh b/milena/sandbox/green/mln/display/display_histo.hh
index d34914c..1fd5da4 100644
--- a/milena/sandbox/green/mln/display/display_histo.hh
+++ b/milena/sandbox/green/mln/display/display_histo.hh
@@ -28,10 +28,12 @@
#ifndef MLN_DISPLAY_DISPLAY_HISTO_HH
# define MLN_DISPLAY_DISPLAY_HISTO_HH
+# include <mln/accu/math/sum.hh>
# include <mln/data/stretch.hh>
-# include <mln/fun/v2v/log.hh>
# include <mln/display/project_histo.hh>
-# include <mln/accu/math/sum.hh>
+# include <mln/fun/v2v/log.hh>
+# include <mln/value/int_u8.hh>
+
/// \file
///
@@ -59,9 +61,12 @@ namespace mln
///
/// The 3d histogram is projected in red/green space by
/// accumulating around the the blue dimension (green and blue
- /// composantes are being correlated). In fact, we sum in along
+ /// composantes are being correlated). In fact, we sum along
/// the blue direction. Then, we stretch value to feet pgm
/// format.
+ /// Direction r = 1
+ /// Direction g = 2
+ /// Direction b = 0
///
/// \parameter[in] histo the histogram in 3d.
/// \result return a equivalent 2d image.
@@ -74,7 +79,7 @@ namespace mln
typedef value::int_u8 t_int_u8;
typedef fun::v2v::log<float> t_log;
- image2d<unsigned> proj = project_histo<t_sum,2>(histo);
+ image2d<unsigned> proj = project_histo<t_sum,0>(histo);
image2d<t_int_u8> proj_int = data::stretch(t_int_u8(),
data::transform(proj,
t_log()));
diff --git a/milena/sandbox/green/mln/display/project_histo.hh b/milena/sandbox/green/mln/display/project_histo.hh
index 63ea84e..f0e6858 100644
--- a/milena/sandbox/green/mln/display/project_histo.hh
+++ b/milena/sandbox/green/mln/display/project_histo.hh
@@ -54,7 +54,7 @@ namespace mln
image2d<mln_result(A)>
project_histo(const image3d<V>& histo);
-#ifndef MLN_INCLUDE_ONLY
+# ifndef MLN_INCLUDE_ONLY
/// \brief Allow the visualization of 3d histogram.
///
@@ -86,7 +86,7 @@ namespace mln
return accu::image::to_result(histo_accu);
}
-#endif // ! MLN_INCLUDE_ONLY
+# endif // ! MLN_INCLUDE_ONLY
} // end of namespace mln::transform
--
1.5.6.5
1
0

last-svn-commit-17-gc6ff97e Fix bugs in regional_maxima routine, work with rgb8 for stats.
by green 24 Feb '10
by green 24 Feb '10
24 Feb '10
* green/demo/labeling/regional_maxima/regional_maxima.cc
(compute_stats): New function.
* green/demo/labeling/regional_maxima/regional_maxima.cc
(demo,main): Update functions to map Theo's view.
---
milena/sandbox/ChangeLog | 10 +
.../labeling/regional_maxima/regional_maxima.cc | 261 ++++++++++++++++----
2 files changed, 221 insertions(+), 50 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 2f5eae8..b180063 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,13 @@
+2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Fix bugs in regional_maxima routine, work with rgb8 for stats.
+
+ * green/demo/labeling/regional_maxima/regional_maxima.cc
+ (compute_stats): New function.
+
+ * green/demo/labeling/regional_maxima/regional_maxima.cc
+ (demo,main): Update functions to map Theo's view.
+
2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Test the local deviation operator (Millet2008) on the annotating base.
diff --git a/milena/sandbox/green/demo/labeling/regional_maxima/regional_maxima.cc b/milena/sandbox/green/demo/labeling/regional_maxima/regional_maxima.cc
index 266fbfe..c832486 100644
--- a/milena/sandbox/green/demo/labeling/regional_maxima/regional_maxima.cc
+++ b/milena/sandbox/green/demo/labeling/regional_maxima/regional_maxima.cc
@@ -2,6 +2,7 @@
#include <iostream>
#include <sstream>
+#include <boost/format.hpp>
#include <mln/img_path.hh>
@@ -106,30 +107,31 @@ struct t_labeling_rgbn : mln::Function_v2v< t_labeling_rgbn<n> >
}
};
+// Version optimisée de mean_values
-// version non optimisée de label
-
-template <unsigned n>
-mln::image2d<mln::value::label_8>
-label_image(const mln::image2d< mln::value::rgb<n> >& input,
- const mln::image3d< mln::value::label_8>& label)
+struct t_mean_lbl8_with_rgb8 : mln::Function_v2v< t_mean_lbl8_with_rgb8 >
{
- mln::image2d<mln::value::label_8> output;
+ typedef mln::value::rgb8 t_rgb8;
+ typedef mln::algebra::vec<3,float> t_vec3f;
+ typedef mln::value::label_8 t_lbl8;
+ typedef t_lbl8 argument;
+ typedef t_rgb8 result;
+ typedef mln::image3d<t_lbl8> t_label;
+ typedef mln::util::array<t_vec3f> t_mean_array;
- initialize(output, input);
+ const t_mean_array& _mean_array;
- mln_piter(mln::image2d< mln::value::label_8 >) po(output.domain());
- mln_piter(mln::image2d< mln::value::rgb<n> >) pi(input.domain());
+ t_mean_lbl8_with_rgb8(const t_mean_array& mean_array) :
+ _mean_array(mean_array) {}
- for_all_2(po, pi)
+ result operator()(const argument& c) const
{
- const mln::value::rgb<n>& vi = input(pi);
+ t_rgb8 tmp = _mean_array[c];
- output(po) = mln::opt::at(label, vi.blue(), vi.red(), vi.green());
+ return tmp;
}
+};
- return output;
-}
template <unsigned n>
unsigned unquant(const float& value)
@@ -253,6 +255,109 @@ void print_count2(const mln::image2d<mln::value::rgb<n> >& input_rgbn,
}
}
+template <unsigned n>
+mln::image2d<mln::value::label_8>
+compute_stats(const mln::image2d<mln::value::rgb8>& input_rgb8,
+ const mln::image2d<mln::value::rgb<n> >& input_rgbn,
+ const mln::image3d<unsigned>& histo,
+ const mln::image3d<mln::value::label_8>& label,
+ const unsigned n_labels)
+{
+ typedef mln::value::label_8 t_lbl8;
+ typedef mln::value::rgb<n> t_rgbn;
+ typedef mln::value::rgb8 t_rgb8;
+ typedef mln::value::int_u<n> t_int_un;
+ typedef mln::algebra::vec<3,float> t_vec3f;
+ typedef mln::accu::math::sum<unsigned,unsigned> t_sum;
+ typedef mln::accu::stat::mean<t_vec3f,t_vec3f,t_vec3f> t_mean;
+ typedef mln::image2d<t_lbl8> t_image2d_lbl8;
+ typedef mln::image2d<t_rgbn> t_image2d_rgbn;
+ typedef mln::image2d<t_rgb8> t_image2d_rgb8;
+ typedef mln::image2d<t_int_un> t_image2d_int_un;
+ typedef mln::util::array<unsigned> t_count_array;
+ typedef mln::util::array<t_vec3f> t_mean_array;
+
+ mln::util::array<float> abs((unsigned)(n_labels)+1);
+ mln::util::array<float> rel((unsigned)(n_labels)+1);
+ unsigned nb = 0;
+
+ for (unsigned i = 0; i <= n_labels; ++i)
+ {
+ abs[i] = 0.0;
+ rel[i] = 0.0;
+ }
+
+ // COMPUTE THE SUM
+ t_count_array count = mln::labeling::compute(t_sum(),
+ histo,
+ label,
+ n_labels);
+
+ // COMPUTE THE TOTAL
+ for (unsigned i = 0; i <= n_labels; ++i)
+ {
+ unsigned c = count[i];
+ nb += c;
+ }
+
+ // COMPUTE THE PERCENTAGES
+ for (unsigned i = 0; i <= n_labels; ++i)
+ if (0 < count[i])
+ {
+ abs[i] = ((float)count[i] / nb)*100.0;
+ rel[i] = ((float)count[i] / (nb - count[0]))*100.0;
+ }
+
+ // COMPUTE THE MEAN
+ t_image2d_lbl8 label_img = mln::data::transform(input_rgbn,
+ t_labeling_rgbn<n>(label));
+
+ t_mean_array mean = mln::labeling::compute(t_mean(),
+ input_rgb8,
+ label_img,
+ n_labels);
+
+ // CORRECT LABEL 0 STATS
+ rel[0] = 0;
+ mean[0][0] = 255.0;
+ mean[0][1] = 255.0;
+ mean[0][2] = 0.0;
+
+ for (unsigned i = 0; i <= n_labels; ++i)
+ {
+ const t_vec3f& mean_v = mean[i];
+
+ std::cout << boost::format("%2i|"
+ "r = %6.2f, g = %6.2f, b = %6.2f |"
+ "c = %7i, %%i = %5.2f, %%c = %5.2f")
+ % i
+ % mean_v[0]
+ % mean_v[1]
+ % mean_v[2]
+ % count[i]
+ % abs[i]
+ % rel[i]
+ << std::endl;
+ /*
+ std::cout << i << "|("
+ << "r = " << unquant<n>(mean_v[0]) << ", "
+ << "g = " << unquant<n>(mean_v[1]) << ", "
+ << "b = " << unquant<n>(mean_v[2]) << ")|("
+ << "c = " << count[i] << ", "
+ << "%i= " << abs[i] << "%, "
+ << "%c= " << rel[i] << "%)"
+ << std::endl;
+ */
+ }
+
+ t_image2d_rgb8 mean_rgb8 = mln::data::transform(label_img,
+ t_mean_lbl8_with_rgb8(mean));
+
+ mln::io::ppm::save(mean_rgb8, "mean.ppm");
+
+ return label_img;
+}
+
void print_count(const mln::image3d<unsigned>& histo,
const mln::image3d<mln::value::label_8>& label,
const unsigned n_labels)
@@ -320,26 +425,32 @@ void print_count(const mln::image3d<unsigned>& histo,
template <unsigned n>
struct t_merge_lbl8_with_rgbn : mln::Function_v2v< t_merge_lbl8_with_rgbn<n> >
{
- typedef mln::value::rgb<n> t_rgbn;
- typedef mln::value::label_8 t_lbl8;
- typedef t_rgbn argument;
- typedef t_rgbn result;
- typedef mln::image3d<t_lbl8> t_label;
+ typedef mln::value::rgb<n> t_rgbn;
+ typedef mln::value::rgb8 t_rgb8;
+ typedef mln::value::label_8 t_lbl8;
+ typedef t_rgb8 argument;
+ typedef t_rgb8 result;
+ typedef mln::image3d<t_lbl8> t_label;
+ typedef mln::fun::v2v::rgb8_to_rgbn<n> t_rgb8_to_rgbn;
- const t_label& _label;
+ const t_label& _label;
+ const t_rgb8_to_rgbn _convert;
t_merge_lbl8_with_rgbn(const t_label& label) : _label(label) {}
result operator()(const argument& c) const
{
- t_rgbn tmp = c;
+ t_rgb8 tmp_rgb8 = c;
+ t_rgbn tmp_rgbn = _convert(c);
- if (0 == mln::opt::at(_label, c.blue(), c.red(), c.green()))
+ if (0==mln::opt::at(_label,tmp_rgbn.blue(),tmp_rgbn.red(),tmp_rgbn.green()))
{
- tmp = mln::literal::black;
+ // tmp = mln::literal::black;
+ // tmp = mln::literal::yellow;
+ tmp_rgb8 = mln::literal::red;
}
- return tmp;
+ return tmp_rgb8;
}
};
@@ -452,13 +563,8 @@ int main2()
// n < 8, n is the degree of quantification
template <unsigned n>
-void demo()
+void demo(const std::string& image, const unsigned min_volume)
{
- const unsigned min_volume = 1000;
- //const std::string& image = OLENA_IMG_PATH"/fly.ppm";
- const std::string& image = SCRIBO_PPM_IMG_PATH"/mp00082c_50p.ppm";
- //const std::string& image = OLENA_IMG_PATH"/tiny.ppm";
-
typedef mln::value::label_8 t_lbl8;
typedef mln::value::int_u8 t_int_u8;
typedef mln::value::rgb8 t_rgb8;
@@ -473,16 +579,13 @@ void demo()
typedef mln::fun::v2v::rgb8_to_rgbn<n> t_rgb8_to_rgbn;
typedef mln::accu::meta::stat::histo3d_rgb t_histo3d_fun;
- mln::util::timer timer;
-
// START OF IMAGE PROCESSING CHAIN
- timer.start();
-
t_image2d_rgb8 input_rgb8;
t_image2d_rgbn input_rgbn;
- t_image2d_rgbn output_rgbn;
- // t_image2d_rgbn mean_rgb5;
+ t_image2d_rgb8 output_rgb8;
+ t_image2d_rgb8 mean_rgb8;
t_histo3d histo;
+ t_histo3d histo2;
// t_image2d_int_u8 projected;
// t_image2d_int_u8 filtered;
t_histo3d opened;
@@ -490,18 +593,35 @@ void demo()
t_image2d_lbl8 label_img;
t_image3d_lbl8 dilated;
t_lbl8 n_labels;
- // t_rgbn value_rgbn;
mln::io::ppm::load(input_rgb8, image.c_str());
input_rgbn = mln::data::transform(input_rgb8, t_rgb8_to_rgbn());
histo = mln::data::compute(t_histo3d_fun(), input_rgbn);
opened = mln::morpho::opening::volume(histo, mln::c6(), min_volume);
label = mln::labeling::regional_maxima(opened, mln::c6(), n_labels);
- dilated = mln::morpho::elementary::dilation(label, mln::c26());
+ // dilated = mln::morpho::elementary::dilation(label, mln::c26());
- timer.stop();
// END OF IMAGE PROCESSING CHAIN
+
+ // BEGIN DUMPING
+ label_img = compute_stats(input_rgb8, input_rgbn, histo, label, n_labels);
+ // mean_rgb8 = mln::labeling::mean_values(input_rgb8, label_img, n_labels);
+ // mln::io::ppm::save(mean_rgb8, "mean.ppm");
+
+ output_rgb8 = mln::data::transform(input_rgb8,
+ t_merge_lbl8_with_rgbn<5>(label));
+
+
+ mln::io::ppm::save(output_rgb8, "merge.ppm");
+ mln::io::pgm::save(label_img, "label.pgm");
+
+
+// histo2 = mln::data::compute(t_histo3d_fun(), mean_rgbn);
+// mln::debug::println(histo2);
+ // END DUMPING
+
+/*
std::ostringstream name;
std::ostringstream name2;
std::ostringstream name3;
@@ -510,17 +630,11 @@ void demo()
name2 << "output_rgb" << n << ".ppm";
name3 << "label_img" << n << ".pgm";
- std::cout << "Done in : " << timer.read() << " s" << std::endl;
std::cout << "Labels : " << n_labels << std::endl;
std::cout << "Name : " << name.str() << std::endl;
- mln::io::ppm::save(input_rgbn, name.str());
-
- mln::util::timer timer2;
+// mln::io::ppm::save(input_rgbn, name.str());
- timer2.start();
- print_count2(input_rgbn, histo, dilated, n_labels);
- timer2.stop();
std::cout << "timer2 : " << timer2.read() << std::endl;
output_rgbn = mln::data::transform(input_rgbn,
t_merge_lbl8_with_rgbn<n>(label));
@@ -531,7 +645,7 @@ void demo()
t_labeling_rgbn<n>(label));
// label_img = label_image<n>(input_rgbn, dilated);
mln::io::pgm::save(label_img, name3.str());
-
+*/
// localiser les couleurs sur l'image (fond en black, le reste)
@@ -571,8 +685,8 @@ void demo()
*/
}
-
-int main()
+/*
+int main_old()
{
demo<2>(); // 2.26 s
demo<3>(); // 2.29 s
@@ -582,3 +696,50 @@ int main()
demo<7>(); // 11.43 s
demo<8>(); // 96.19 s
}
+*/
+void usage()
+{
+ std::cout << std::endl;
+ std::cout << "regional_maxima" << std::endl;
+ std::cout << "image <name>" << std::endl;
+ std::cout << "quantification {5,6}" << std::endl;
+ std::cout << "volume 1000" << std::endl;
+
+ // 3 paramètres en entré:
+ // * l'image
+ // * la quantification utilisée
+ // * le volume minimale laissé pour les pics de l'histo
+
+ // sorties:
+ // * fichier de stats [etiquette|couleur moyenne|% image|% classé]
+ // * couleur moyenne de l'étiquette + couleur specifique pour étiquette 0
+ // * histo sur l'image d'étiquette
+}
+
+int main(int argc, char* args[])
+{
+ if (argc != 3)
+ {
+ // const std::string& image = OLENA_IMG_PATH"/fly.ppm";
+ const std::string& image = SCRIBO_PPM_IMG_PATH"/mp00082c_50p.ppm";
+ // const std::string& image = OLENA_IMG_PATH"/tiny.ppm";
+ // const std::string image = OLENA_IMG_PATH"/tiny.ppm";
+ const unsigned min_volume = 1000;
+ // const unsigned min_volume = atoi(args[2]);
+
+ switch(args[2][0])
+ {
+ case '2': demo<2>(image, min_volume); break;
+ case '3': demo<3>(image, min_volume); break;
+ case '4': demo<4>(image, min_volume); break;
+ case '5': demo<5>(image, min_volume); break;
+ case '6': demo<6>(image, min_volume); break;
+ case '7': demo<7>(image, min_volume); break;
+ case '8': demo<8>(image, min_volume); break;
+ default: demo<5>(image, min_volume); break;
+ // default: usage(); break;
+ }
+ }
+ else
+ usage();
+}
--
1.5.6.5
1
0

last-svn-commit-16-gd0783ce Test the local deviation operator (Millet2008) on the annotating base.
by green 24 Feb '10
by green 24 Feb '10
24 Feb '10
* green/exp/annotating/stddev_color_16: New directory.
* green/exp/annotating/stddev_color_16/Makefile.am: New Makefile.
* green/exp/annotating/stddev_color_16/stddev_color_16.cc: New demo.
---
milena/sandbox/ChangeLog | 8 ++
.../{nb_color => stddev_color_16}/Makefile.am | 0
.../annotating/stddev_color_16/stddev_color_16.cc | 87 ++++++++++++--------
3 files changed, 60 insertions(+), 35 deletions(-)
copy milena/sandbox/green/exp/annotating/{nb_color => stddev_color_16}/Makefile.am (100%)
copy milena/sandbox/green/{demo => exp}/annotating/stddev_color_16/stddev_color_16.cc (70%)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index bc8efb2..2f5eae8 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,13 @@
2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Test the local deviation operator (Millet2008) on the annotating base.
+
+ * green/exp/annotating/stddev_color_16: New directory.
+ * green/exp/annotating/stddev_color_16/Makefile.am: New Makefile.
+ * green/exp/annotating/stddev_color_16/stddev_color_16.cc: New demo.
+
+2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Introduce the local deviation operator (Millet2008) which
subdivise the image in 16 parts.
diff --git a/milena/sandbox/green/exp/annotating/nb_color/Makefile.am b/milena/sandbox/green/exp/annotating/stddev_color_16/Makefile.am
similarity index 100%
copy from milena/sandbox/green/exp/annotating/nb_color/Makefile.am
copy to milena/sandbox/green/exp/annotating/stddev_color_16/Makefile.am
diff --git a/milena/sandbox/green/demo/annotating/stddev_color_16/stddev_color_16.cc b/milena/sandbox/green/exp/annotating/stddev_color_16/stddev_color_16.cc
similarity index 70%
copy from milena/sandbox/green/demo/annotating/stddev_color_16/stddev_color_16.cc
copy to milena/sandbox/green/exp/annotating/stddev_color_16/stddev_color_16.cc
index 5e95c76..c196595 100644
--- a/milena/sandbox/green/demo/annotating/stddev_color_16/stddev_color_16.cc
+++ b/milena/sandbox/green/exp/annotating/stddev_color_16/stddev_color_16.cc
@@ -2,6 +2,7 @@
#include <iostream>
#include <sstream>
+#include <boost/filesystem.hpp>
#include <mln/img_path.hh>
@@ -27,6 +28,7 @@
#include <mln/io/plot/save_image_sh.hh>
#include <mln/math/sqr.hh>
+#include <mln/math/max.hh>
#include <mln/opt/at.hh>
@@ -41,9 +43,7 @@ float r(short p, unsigned histo_p, short x, unsigned histo_x)
return result;
}
-unsigned stddev_color(mln::image2d<mln::value::int_u8> input_int_u8,
- const char *name_histo,
- const char *name_image)
+float stddev_color(mln::image2d<mln::value::int_u8> input_int_u8)
{
typedef mln::point1d t_point1d;
typedef mln::value::rgb8 t_rgb8;
@@ -57,15 +57,8 @@ unsigned stddev_color(mln::image2d<mln::value::int_u8> input_int_u8,
t_histo1d histo;
- std::cout << "histo : " << name_histo << std::endl;
- std::cout << "image : " << name_image << std::endl;
-
histo = mln::data::compute(t_histo1d_fun(), input_int_u8);
- mln::io::pgm::save(input_int_u8, name_image);
- mln::io::plot::save_image_sh(histo, name_histo);
- mln::debug::println(histo);
-
// Find the peak of the histogram
unsigned v_max = mln::opt::at(histo, 0);
short p_max = 0;
@@ -100,16 +93,10 @@ unsigned stddev_color(mln::image2d<mln::value::int_u8> input_int_u8,
stddev = (250 < p_max)? stddev_low : (5 > p_max)? stddev_up :
(stddev_low + stddev_up)/2;
- std::cout << "max_site : " << p_max << std::endl;
- std::cout << "h(max_site) : " << v_max << std::endl;
- std::cout << "stddev_up : " << stddev_up << std::endl;
- std::cout << "stddev_low : " << stddev_low << std::endl;
- std::cout << "stddev : " << stddev << std::endl;
-
- return 0;
+ return stddev;
}
-unsigned stddev_color_16(const std::string& image)
+float stddev_color_16(const std::string& image)
{
typedef mln::point1d t_point1d;
typedef mln::value::rgb8 t_rgb8;
@@ -134,8 +121,7 @@ unsigned stddev_color_16(const std::string& image)
unsigned sz_row = (pmax.row() - pmin.row())/ 4;
unsigned sz_col = (pmax.col() - pmin.col())/ 4;
-
- std::cout << domain << std::endl;
+ float stddev = 0.0;
// Divide the domain in nine sub-domains.
for (unsigned i = 0; i < 4; ++i)
@@ -145,34 +131,65 @@ unsigned stddev_color_16(const std::string& image)
mln::point2d max(pmin.row()+sz_row*(i+1),pmin.col()+sz_col*(j+1));
mln::box2d dom(min,max);
- std::cout << dom << std::endl;
-
// Save it
t_image2d_int_u8 input_1o16_int_u8(dom);
- std::ostringstream name_histo("");
- std::ostringstream name_image("");
-
- name_histo << "histo" << i << "_" << j << ".sh";
- name_image << "image" << i << "_" << j << ".ppm";
mln::data::paste(input_int_u8 | dom, input_1o16_int_u8);
- stddev_color(input_1o16_int_u8,
- name_histo.str().c_str(),
- name_image.str().c_str());
+ stddev = mln::math::max(stddev, stddev_color(input_1o16_int_u8));
}
- return 0;
+ return stddev;
}
int main()
{
-// unsigned val = stddev_color_16(ANNOTATING_PHOTO_IMG_PATH "/photo01.ppm");
- unsigned val = stddev_color_16(ANNOTATING_LOGO_IMG_PATH "/logo06.ppm");
+ typedef boost::filesystem::path t_path;
+ typedef boost::filesystem::directory_iterator t_iter_path;
+
+ t_path full_path[] = {t_path(ANNOTATING_BILL_IMG_PATH),
+ t_path(ANNOTATING_FAX_IMG_PATH),
+ t_path(ANNOTATING_HANDWRITTEN_IMG_PATH),
+ t_path(ANNOTATING_LOGO_IMG_PATH),
+ t_path(ANNOTATING_MAP_IMG_PATH),
+ t_path(ANNOTATING_PHOTO_IMG_PATH),
+ t_path(ANNOTATING_SCREENSHOT_IMG_PATH),
+ t_path(ANNOTATING_SLIDE_IMG_PATH),
+ t_path(ANNOTATING_TYPED_IMG_PATH)};
+
+ for (int i = 0; i < 9; ++i)
+ {
+ std::cerr << "entering " << full_path[i] << std::endl;
+ std::cout << "entering " << full_path[i] << std::endl;
-// std::cout << "nb color : " << val << 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 count = 0;
+ float sum1 = 0;
+ float sum2 = 0;
+
+ for (t_iter_path dir_iter(full_path[i]); end_iter != dir_iter; ++dir_iter)
+ {
+ float val = stddev_color_16(dir_iter->path().string());
+
+ ++count;
+ sum1 += val;
+ sum2 += val*val;
+
+ std::cout << dir_iter->path().string() << " => " << val << std::endl;
+ }
+
+ float mean = sum1 / count;
+ float var = ((float)sum2 / count) - (mean * mean);
+
+ std::cout << "mean : " << mean << std::endl;
+ std::cout << "var : " << var << std::endl;
+ }
+ }
return 0;
}
-
--
1.5.6.5
1
0

last-svn-commit-15-g047c908 Introduce the local deviation operator (Millet2008) which subdivise the image in 16 parts.
by green 24 Feb '10
by green 24 Feb '10
24 Feb '10
* green/demo/annotating/stddev_color_16: New directory.
* green/demo/annotating/stddev_color_16/Makefile.am: New Makefile.
* green/demo/annotating/stddev_color_16/stddev_color_16.cc: New demo.
---
milena/sandbox/ChangeLog | 9 +
.../{bic => stddev_color_16}/Makefile.am | 0
.../annotating/stddev_color_16/stddev_color_16.cc | 178 ++++++++++++++++++++
3 files changed, 187 insertions(+), 0 deletions(-)
copy milena/sandbox/green/demo/annotating/{bic => stddev_color_16}/Makefile.am (100%)
create mode 100644 milena/sandbox/green/demo/annotating/stddev_color_16/stddev_color_16.cc
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 2fecbe3..bc8efb2 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,14 @@
2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+ Introduce the local deviation operator (Millet2008) which
+ subdivise the image in 16 parts.
+
+ * green/demo/annotating/stddev_color_16: New directory.
+ * green/demo/annotating/stddev_color_16/Makefile.am: New Makefile.
+ * green/demo/annotating/stddev_color_16/stddev_color_16.cc: New demo.
+
+2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
Group Millet2008 documentation files.
* green/doc/annotating: New directory.
diff --git a/milena/sandbox/green/demo/annotating/bic/Makefile.am b/milena/sandbox/green/demo/annotating/stddev_color_16/Makefile.am
similarity index 100%
copy from milena/sandbox/green/demo/annotating/bic/Makefile.am
copy to milena/sandbox/green/demo/annotating/stddev_color_16/Makefile.am
diff --git a/milena/sandbox/green/demo/annotating/stddev_color_16/stddev_color_16.cc b/milena/sandbox/green/demo/annotating/stddev_color_16/stddev_color_16.cc
new file mode 100644
index 0000000..5e95c76
--- /dev/null
+++ b/milena/sandbox/green/demo/annotating/stddev_color_16/stddev_color_16.cc
@@ -0,0 +1,178 @@
+// COMPUTING THE STDEV OF THE COLORS
+
+#include <iostream>
+#include <sstream>
+
+#include <mln/img_path.hh>
+
+#include <mln/accu/max_site.hh>
+#include <mln/accu/stat/histo1d.hh>
+
+#include <mln/core/macros.hh>
+#include <mln/core/image/image1d.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/core/image/image3d.hh>
+
+#include <mln/debug/println.hh>
+
+#include <mln/data/compute.hh>
+#include <mln/data/fill.hh>
+#include <mln/data/transform.hh>
+#include <mln/data/paste.hh>
+
+#include <mln/fun/v2v/rgb8_to_int_u8.hh>
+
+#include <mln/io/ppm/load.hh>
+#include <mln/io/pgm/save.hh>
+#include <mln/io/plot/save_image_sh.hh>
+
+#include <mln/math/sqr.hh>
+
+#include <mln/opt/at.hh>
+
+#include <mln/value/rgb8.hh>
+#include <mln/value/int_u.hh>
+
+
+float r(short p, unsigned histo_p, short x, unsigned histo_x)
+{
+ float result = mln::math::sqr(((float)histo_x / histo_p) * (x-p));
+
+ return result;
+}
+
+unsigned stddev_color(mln::image2d<mln::value::int_u8> input_int_u8,
+ const char *name_histo,
+ const char *name_image)
+{
+ typedef mln::point1d t_point1d;
+ typedef mln::value::rgb8 t_rgb8;
+ typedef mln::value::int_u8 t_int_u8;
+ typedef mln::image2d<t_rgb8> t_image2d_rgb8;
+ typedef mln::image2d<t_int_u8> t_image2d_int_u8;
+ typedef mln::image1d<unsigned> t_histo1d;
+ typedef mln::fun::v2v::rgb8_to_int_u8 t_rgb8_to_int_u8;
+ typedef mln::accu::meta::stat::histo1d t_histo1d_fun;
+ typedef mln::accu::max_site<t_histo1d> t_max_site_fun;
+
+ t_histo1d histo;
+
+ std::cout << "histo : " << name_histo << std::endl;
+ std::cout << "image : " << name_image << std::endl;
+
+ histo = mln::data::compute(t_histo1d_fun(), input_int_u8);
+
+ mln::io::pgm::save(input_int_u8, name_image);
+ mln::io::plot::save_image_sh(histo, name_histo);
+ mln::debug::println(histo);
+
+ // Find the peak of the histogram
+ unsigned v_max = mln::opt::at(histo, 0);
+ short p_max = 0;
+
+ mln_piter_(t_histo1d) p(histo.domain());
+
+ for_all(p)
+ {
+ if (v_max < histo(p))
+ {
+ v_max = histo(p);
+ p_max = p.ind();
+ }
+ }
+
+ // Compute the specific stddev
+
+ float stddev_low = 0.0;
+ float stddev_up = 0.0;
+ float stddev = 0.0;
+
+ if (250 > p_max)
+ for (short i = p_max+1; i < p_max+6; ++i)
+ stddev_up += r(p_max, mln::opt::at(histo,p_max),
+ i, mln::opt::at(histo,i));
+
+ if (5 < p_max)
+ for (short i = p_max-1; i > p_max-6; --i)
+ stddev_low += r(p_max, mln::opt::at(histo,p_max),
+ i, mln::opt::at(histo,i));
+
+ stddev = (250 < p_max)? stddev_low : (5 > p_max)? stddev_up :
+ (stddev_low + stddev_up)/2;
+
+ std::cout << "max_site : " << p_max << std::endl;
+ std::cout << "h(max_site) : " << v_max << std::endl;
+ std::cout << "stddev_up : " << stddev_up << std::endl;
+ std::cout << "stddev_low : " << stddev_low << std::endl;
+ std::cout << "stddev : " << stddev << std::endl;
+
+ return 0;
+}
+
+unsigned stddev_color_16(const std::string& image)
+{
+ typedef mln::point1d t_point1d;
+ typedef mln::value::rgb8 t_rgb8;
+ typedef mln::value::int_u8 t_int_u8;
+ typedef mln::image2d<t_rgb8> t_image2d_rgb8;
+ typedef mln::image2d<t_int_u8> t_image2d_int_u8;
+ typedef mln::image1d<unsigned> t_histo1d;
+ typedef mln::fun::v2v::rgb8_to_int_u8 t_rgb8_to_int_u8;
+ typedef mln::accu::meta::stat::histo1d t_histo1d_fun;
+ typedef mln::accu::max_site<t_histo1d> t_max_site_fun;
+
+ t_image2d_rgb8 input_rgb8;
+ t_image2d_int_u8 input_int_u8;
+
+ mln::io::ppm::load(input_rgb8, image.c_str());
+ input_int_u8 = mln::data::transform(input_rgb8, t_rgb8_to_int_u8());
+
+ // IMAGE SPLITTING PHASE
+ mln::box2d domain = input_int_u8.domain();
+ mln::point2d pmin = domain.pmin();
+ mln::point2d pmax = domain.pmax();
+
+ unsigned sz_row = (pmax.row() - pmin.row())/ 4;
+ unsigned sz_col = (pmax.col() - pmin.col())/ 4;
+
+ std::cout << domain << std::endl;
+
+ // Divide the domain in nine sub-domains.
+ for (unsigned i = 0; i < 4; ++i)
+ for (unsigned j = 0; j < 4; ++j)
+ {
+ mln::point2d min(pmin.row()+sz_row*i,pmin.col()+sz_col*j);
+ mln::point2d max(pmin.row()+sz_row*(i+1),pmin.col()+sz_col*(j+1));
+ mln::box2d dom(min,max);
+
+ std::cout << dom << std::endl;
+
+ // Save it
+ t_image2d_int_u8 input_1o16_int_u8(dom);
+ std::ostringstream name_histo("");
+ std::ostringstream name_image("");
+
+ name_histo << "histo" << i << "_" << j << ".sh";
+ name_image << "image" << i << "_" << j << ".ppm";
+
+ mln::data::paste(input_int_u8 | dom, input_1o16_int_u8);
+
+ stddev_color(input_1o16_int_u8,
+ name_histo.str().c_str(),
+ name_image.str().c_str());
+ }
+
+ return 0;
+}
+
+
+int main()
+{
+// unsigned val = stddev_color_16(ANNOTATING_PHOTO_IMG_PATH "/photo01.ppm");
+ unsigned val = stddev_color_16(ANNOTATING_LOGO_IMG_PATH "/logo06.ppm");
+
+// std::cout << "nb color : " << val << std::endl;
+
+ return 0;
+}
+
--
1.5.6.5
1
0
* green/doc/annotating: New directory.
* green/doc/annotating/class.txt: New hierarchy description.
* green/doc/annotating/testMillet2008.txt: New result interpretations.
* green/doc/annotating/syntheseMillet2008.txt: New feature extractions.
* green/demo/annotating/class.txt: Remove this obsolete file.
---
milena/sandbox/ChangeLog | 10 +
milena/sandbox/green/demo/annotating/class.txt | 33 ---
milena/sandbox/green/doc/annotating/class.txt | 42 +++
.../green/doc/annotating/syntheseMillet2008.txt | 283 ++++++++++++++++++++
milena/sandbox/green/doc/annotating/testMillet2008 | 69 +++++
5 files changed, 404 insertions(+), 33 deletions(-)
delete mode 100644 milena/sandbox/green/demo/annotating/class.txt
create mode 100644 milena/sandbox/green/doc/annotating/class.txt
create mode 100644 milena/sandbox/green/doc/annotating/syntheseMillet2008.txt
create mode 100644 milena/sandbox/green/doc/annotating/testMillet2008
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index ffbc6e3..2fecbe3 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,13 @@
+2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Group Millet2008 documentation files.
+
+ * green/doc/annotating: New directory.
+ * green/doc/annotating/class.txt: New hierarchy description.
+ * green/doc/annotating/testMillet2008.txt: New result interpretations.
+ * green/doc/annotating/syntheseMillet2008.txt: New feature extractions.
+ * green/demo/annotating/class.txt: Remove this obsolete file.
+
2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Correct typo into directories.
diff --git a/milena/sandbox/green/demo/annotating/class.txt b/milena/sandbox/green/demo/annotating/class.txt
deleted file mode 100644
index ec7e92e..0000000
--- a/milena/sandbox/green/demo/annotating/class.txt
+++ /dev/null
@@ -1,33 +0,0 @@
-Dans scribo les classes de documents sont:
-
-- image seule (photo)
-- courrier manuscrit
-- courrier dactylographié
-- facture ou feuille organisée sous forme de tableau
-- article de journal
-- document composite
-- infographie (logo, carte, dessin vectoriel)
-- slide (copie d'écran ou sauvegarde au format image)
-
-
-Où se situent les faxes ?
-
-
-Description d'un fax:
-- ratio l/L assimilable à du A4 ou US Letter
-- nombre de couleurs très petit, < 1000
-- plutôt du N & B, mais quelques faxes sont en couleurs
-- généralement un % élevé de blanc (la page vierge)
-
-
-Description d'un article de journal:
-- nombre élevés de couleurs (> 10 000) en général
-- quelques articles de conférences autour de 5000
-
-
-Description des photos:
-- un nombre très élevé de couleurs
-- ratio non A4, non US Letter
-
-
-
diff --git a/milena/sandbox/green/doc/annotating/class.txt b/milena/sandbox/green/doc/annotating/class.txt
new file mode 100644
index 0000000..0fa5cf9
--- /dev/null
+++ b/milena/sandbox/green/doc/annotating/class.txt
@@ -0,0 +1,42 @@
+Dans scribo les classes de documents sont:
+
+- image seule (photo)
+- courrier manuscrit
+- courrier dactylographié
+- facture ou feuille organisée sous forme de tableau
+- article de journal
+- document composite
+- infographie (logo, carte, dessin vectoriel)
+- slide (copie d'écran ou sauvegarde au format image)
+
+Le problème avec cette hiérarchie c'est quelle induit une connaissance
+fonctionnelle des images traitées et que les extracteurs de primitives font
+plutôt ressortir des informations relatives à la nature de l'image.
+
+Par exemple, les slides peuvent contenir aussi bien du texte, que des photos
+ou des cliparts. C'est une forme de "composite" par définition.
+
+Où se situent les faxes ?
+
+
+Description d'un fax:
+- ratio l/L assimilable à du A4 ou US Letter
+- nombre de couleurs très petit, < 1000
+- plutôt du N & B, mais quelques faxes sont en couleurs
+- généralement un % élevé de blanc (la page vierge)
+
+
+Description d'un article de journal:
+- nombre élevés de couleurs (> 10 000) en général
+- quelques articles de conférences autour de 5000
+
+
+Description des photos:
+- un nombre très élevé de couleurs
+- ratio non A4, non US Letter
+
+
+Google hiérarchie:
+- line drawing
+- clipart
+- photo
diff --git a/milena/sandbox/green/doc/annotating/syntheseMillet2008.txt b/milena/sandbox/green/doc/annotating/syntheseMillet2008.txt
new file mode 100644
index 0000000..b7b3648
--- /dev/null
+++ b/milena/sandbox/green/doc/annotating/syntheseMillet2008.txt
@@ -0,0 +1,283 @@
+
+Millet utilise un certain nombre de descripteurs (p 65, Chapitre 3)
+pour l'annotation automatique. Son objectif est de formuler une
+annotation automatique simple à partir de descripteurs de bas niveaux
+qui permettent de réaliser l'opération en moins de 10 secondes.
+
+L'auteur présente dans le chapitre 4, p 77 l'arbre de classification
+et l'utilisation précise qu'il fait de ces descripteurs.
+
+
+Reconnaissance des images de clipart versus photographies
+Reconnaissance des images Noir & Blanc versus Couleur
+Reconnaissance Interieur versus Exterieur
+Autre reconnaissance cartes, photos, peintures.
+
+
+ /---------Image------------\
+ | |
+ v v
+ /-------+------+-------\ /-------+----------\
+ | | | | | | |
+ v v | v v v v
+Carte Clipart | Peinture Couleur N&B N&B colorisé
+ |
+ v
+ /----Photo----------\
+ | |
+ v |
+ /----------\ |
+ | | |
+ v | v
+Intérieur | Visages
+ |
+ v
+ /-----Extérieur------\
+ | |
+ v v
+ /-----\ /-----\
+ | | | |
+ v v v v
+Jour Nuit Nature Urbain
+
+
+Note:
+-----
+Lorsque d'un concept, on part de sa droite et de sa gauche, il s'agit en fait
+de tests différents effectués en parallèles (ex.: Image, Photo, Extérieur).
+
+Lorsqu'on aboutit à une bifurcation et qu'il ne s'agit pas d'un concept, cela
+correspond à un seul test dont les résultats sont répartis dans des classes
+différentes.
+
+Fax
+Magazine
+
+
+
+ANNEXE 1 : SYNTHESE DESCRIPTEURS MILLET
+=======================================
+
+* RGB-64
+--------
+Chaque composante est quantifiée sur 4 valeurs (4x4x4 = 64), puis on construit
+l'histogramme à 64 composantes.
+
+
+* TSVal
+-------
+A partir de l'espace RGB d'origine, on effectue
+la transformation. Attention les composantes ne sont pas quantifiées
+de la même manière (18 valeurs pour la teinte [17 + 1 pour le
+négatif], Val et S sont quantifiées sur 3 valeurs
+chacunes. L'histogramme obtenu dans cet espace contiendra 162
+composantes.
+
+Val = max(R,G,B)
+S = [max(R,G,B) - min(R,G,B)] / max(R,G,B)
+
+Si R = max(R,G,B)
+Alors T = 60 * (G-B) / [max(R,G,B) - min(R,G,B)]
+
+Si G = max(R,G,B)
+Alors T = 60 * (2 + (B-R) / [max(R,G,B) - min(R,G,B)])
+
+Si B = max(R,G,B)
+Alors T = 60 * (4 + (R-G) / [max(R,G,B) - min(R,G,B)])
+
+
+* RGB-64-9
+----------
+L'image est décomposée en 9 sous images identiques, puis on applique le
+descripteur RGB-64. L'histogramme obtenu est la concaténation des 9
+histogrammes soit un histogramme résultant à 576 composantes.
+
+
+* BIC
+-----
+L'image est quantifiée en 216 couleurs (RGB-216) 6 valeurs par couleur. On
+distingue ensuite les pixels du bord des pixels intérieurs. Les pixels
+intérieurs ont la même couleur que leurs 4-voisins. Un histogramme est crée
+pour chaque groupe de pixels. Puis on concatène
+les histogrammes en un seul de 432 composantes.
+
+
+* LEP
+-----
+On construit une image de gradient avec un sobel 3x3, puis cette image est
+seuillée à 100 et devient donc binaire. On étiquette les configurations
+obtenues avec un masque 3x3 classique (convolution). Il existe 2^9
+configurations possibles. On construit alors un histogramme à 512 composantes.
+
+masque de convolution pour l'identification de la configuration:
+001 002 004
+008 256 016
+032 064 128
+
+
+* GABOR
+-------
+Très coûteux, la réponse de 24 filtres sur une image 300x300 est de l'ordre de
+ 1s. On utilise ici des filtres de taille 8x8.
+
+F(x,y) = [1 / (2 PI sigma_x sigma_y)]
+ * exp[(-1/2)(x^2/sigma_x^2 + y^2/sigma_y^2)] * exp[j2 PI Wx]
+
+sigma_x et sigma_y sont des paramètres d'échelles.
+W permet de changer l'orientation.
+
+Il existe une formule pour trouver les coefficients des filtres une fois que
+l'on a déterminé le nombre d'orientations et d'échelles utilisées. On ne
+retiendra, en sortie de filtre, que la variance et l'énergie. L'auteur
+préconise d'utiliser 6 directions et 4 échelles.
+
+
+--------------GABOR---------MATLAB----------------------------------------------
+function gb=gabor_fn(sigma,theta,lambda,psi,gamma)
+
+sigma_x = sigma;
+sigma_y = sigma/gamma;
+
+% Bounding box
+nstds = 3;
+xmax = max(abs(nstds*sigma_x*cos(theta)),abs(nstds*sigma_y*sin(theta)));
+xmax = ceil(max(1,xmax));
+ymax = max(abs(nstds*sigma_x*sin(theta)),abs(nstds*sigma_y*cos(theta)));
+ymax = ceil(max(1,ymax));
+xmin = -xmax; ymin = -ymax;
+[x,y] = meshgrid(xmin:xmax,ymin:ymax);
+
+% Rotation
+x_theta=x*cos(theta)+y*sin(theta);
+y_theta=-x*sin(theta)+y*cos(theta);
+
+gb=exp(-.5*(x_theta.^2/sigma_x^2+y_theta.^2/sigma_y^2)).*cos(2*pi/lambda*x_theta+psi);
+
+http://matlabserver.cs.rug.nl/cgi-bin/matweb.exe
+Gabor Filters. Tech. rep., 2002.
+--------------GABOR---------MATLAB----------------------------------------------
+
+
+* PROJECTION
+------------
+L'image est redimentionnée en 100x100. Un coup de Sobel 3x3, puis une
+binarisation avec s=100. On considère les moitiées verticales puis
+horizontales. Pour les moitiées verticales, on réalise la somme sur chacune
+des lignes, on obtient alors un vecteur de taille 100.
+Pour les moitiées horizontales, on réalise les sommes des colonnes. On obtient
+alors un vecteur taille 100. Les 4 sous vecteurs obtenus peuvent être
+concaténés pour former un unique descipteur de 400 composantes.
+
+
+
+ANNEXE 2 : SYNTHESE CLASSIFICATION MILLET
+=========================================
+
+
+* Reconnaissance des images de clipart versus photographies
+-----------------------------------------------------------
+
+Construire l'histogramme de l'image, éliminer toutes les couleurs peu
+représentées et ensuite les comptées. Moins de 50 couleurs / 256, c'est un
+clipart, plus de 150 / 256 c'est une photographie. Entre les deux, indécision.
+D'après l'auteur, le test n'est pas complètement fiable et peu être évincé, tout
+dépend de la qualité de la compression des cliparts.
+
+Diviser l'image en 16 imagettes (4x4), calculer la suite pour chaque imagette.
+Trouver le maxima de l'histogramme (noté p)/ p = argmax H(x), x in [0,255].
+Puis on calcule un sigma autour du pic.
+
+sigma^2 = Sum(p-1,p-5) r(x) pour p > 250
+sigma^2 = Sum(p+1,p+5) r(x) pour p < 005
+sigma^2 = (1/2) (Sum(p-1,p-5) r(x) + Sum(p+1,p+5) r(x)) pour les autres p
+
+r(x) = ((H(x)/H(p)) * (x-p))^2
+
+
+Le descripteur de l'image entière est alors le maximum des 16 sigma^2. Si le
+pic est resseré, c'est plutôt un clipart (< 5), sinon plutôt une photographie
+(> 40). Le seuil est fixé à 15.
+
+
+
+* Reconnaissance des images Noir & Blanc versus Couleur
+-------------------------------------------------------
+
+Achromatisme (en passant par TSVal)
+
+si |R - G| < s
+et si |R - B| < s alors R ~ G ~ B
+et si |G - B| < s
+
+==> T = -1
+==> Val = (R + G + B)/3
+
+L'auteur propose s = 0,03
+
+Une image est dite Noir & Blanc (donc Achromatique) si + de 99% des pixels le
+sont. Le test peut être appliqué aux images étiquetées comme des cliparts, ou
+des photographies.
+
+
+Faible saturation:
+
+On établit l'histogramme de la saturation de l'image (0 à 255). Si plus de 95%
+des pixels sont inférieurs à une saturation de 100, alors l'image est faiblement
+saturée. Ce test ne s'applique sur les photographies, surtout pas aux cliparts.
+
+
+Dominance de la teinte (image jaunie):
+
+On construit l'histogramme de la teinte (0 à 255). On localise le maximum de
+l'histogramme. Si + de 95% des pixels ont une distance < 20 du maximum, alors
+l'image est considérée comme Noir & Blanc et on peut donner sa teinte dominante.
+De plus il faut qu'au moins 50% des pixels soient faiblement saturés.
+
+T = -1 Achromatisme
+ 0 <= T < 14 Rouge
+ 14 <= T < 29 Orange
+ 29 <= T < 45 Jaune
+ 45 <= T < 113 Vert
+113 <= T < 149 Cyan
+149 <= T < 205 Bleu
+205 <= T < 235 Violet
+235 <= T < 242 Rose, Magenta
+242 <= T < 255 Rouge
+
+
+ 0 <= V < 82 Noir
+ 82 <= V < 179 Gris
+179 <= V < 255 Blanc
+
+
+Pour un pixel (S, Val)
+si |184 - S| + |65 - Val| < |255 - S| + |125 - Val| alors marron sinon orange.
+
+Et encore
+si la teinte est jaune et Val < 80 alors vert sinon jaune.
+
+
+
+* Reconnaissance Interieur versus Exterieur
+-------------------------------------------
+
+Utilisation des descripteurs LEP et RGB-64. Expérience avec un kpp ~ 80%. Puis
+expérimentation avec un SVM ~ 90% de réussite. Finalement, inclusion dans le SVM
+de LEP, RGB-64, TSVal-125, projection, Bic, Gabor.
+
+
+
+
+* Localisation des visages
+--------------------------
+
+Une semaine d'apprentissage, 5 secondes pour leur localisation. Je ne suis pas
+sûr que cette méthode soit pertinente pour notre contexte applicatif.
+
+
+
+* Autre classification
+----------------------
+
+Utilisation de SVM et de tous les descripteurs possibles comme pour Interieur
+versus Exterieur.
diff --git a/milena/sandbox/green/doc/annotating/testMillet2008 b/milena/sandbox/green/doc/annotating/testMillet2008
new file mode 100644
index 0000000..a5cf22d
--- /dev/null
+++ b/milena/sandbox/green/doc/annotating/testMillet2008
@@ -0,0 +1,69 @@
+Dans le cadre de nos recherches, nous testons le classifieur de
+Millet2008 pour la classification des images en clipart ou en
+photographies. Deux tests sont proposés, le premier est basé sur le
+nombre de couleurs de l'image après un seuillage de l'histogramme de
+façon à éliminer les couleurs de faible contribution; le second test
+consiste à extraire le pic de l'histogramme et à mesurer une
+"variance" normalisée autour de ce pic. Le premier test part du
+principe que les photographies possèdent de très nombreuses couleurs,
+tandis que les cliparts n'en ont que quelques unes. Le test n'est pas
+toujours vérifié. Le second test s'intéresse à la nature de
+l'histogramme. L'idée étant de montrer qu'un histogramme continu, donc
+avec une "variance" élevé autour du pic principal est plutôt
+représentatif des phtotographies, alors qu'une "variance" faible tient
+d'avantage du clipart (peu de couleurs, couleurs isolées). Selon
+l'auteur, ce second test donne de très bon résultats. Il peut être
+affiné en divisant l'image en 16 sous parties et en analysant chacune
+des imagettes avec la technique décrite ci-dessus. Dans ce cas, la
+"variance" de l'image est le max des "variances" des imagettes. Les
+repères suivnt sont donnés par l'auteur, "variance" < 5 pour les
+clipart et "variance" ~ 40 pour les photographies (seuil fixé à 15).
+
+
+Test A (Nombre de couleurs dans l'histogramme):
+-----------------------------------------------
+
+
+Test B ("Variance" autour du pic principal):
+--------------------------------------------
+
+bill: Les images de factures contiennent un ensemble d'informations
+groupés sous forme de tableau. Il peut y avoir plusieurs tableaux,
+visibles ou non. Pour la pupart des histogrammes observés,
+l'information en niveau de gris montre un grand pic blanc sans
+voisinage ou avec un voisinage de taille insignifiante. Toutes les
+factures devraient être classées comme des cliparts sauf exception.
+
+deux images sortent du lot:
+- bill17.ppm => 12.7828
+- bill23.ppm => 17.2565
+
+bill17 contient des dégradés qui viennent épaissir le pic blanc, du
+coup le voisinage autour du pic devient plus important.
+
+bill23 contient un logo et une image de fond en transparence sur le
+tableau. Par ailleurs, certains textes sont sur un fond
+composite. Tous ces éléments viennent épaissir le pic blanc.
+
+Résultat : 29 images / 30 passent le test
+
+
+photo: Les images de l'AFP ont la particularité d'être cadré serré
+pour faire ressortir un élément clé de la scène photographiée. On
+s'attend, d'après l'auteur à obtenir une "variance" proche de 40 (seuil ~ 15).
+
+5 vrai positifs:
+- photo01 ==> 42.9224
+- photo10 ==> 48.0298
+- photo25 ==> 33.6833
+- photo27 ==> 42.9025
+- photo28 ==> 43.5689
+
+des scores faibles:
+-
+
+
+
+
+Test C ("Variance" sur les 16 imagettes):
+-----------------------------------------
\ No newline at end of file
--
1.5.6.5
1
0
* green/demo/annoting: Rename as ...
* green/demo/annotating: ... these.
* green/exp/annoting: Rename as ...
* green/exp/annotating: ... these.
* green/mln/img_path.hh: Propagate mistake corrections.
* green/exp/labeling/regional_maxima/regional_maxima.cc (main):
Rename ANNOTING macro references as ANNOTATING ones.
* green/exp/annotating/stddev_color/stddev_color (main):
Rename ANNOTING macro references as ANNOTATING ones.
* green/exp/annotating/nb_color/nb_color.cc (main):
Rename ANNOTING macro references as ANNOTATING ones.
---
milena/sandbox/ChangeLog | 21 ++++++++++
.../demo/{annoting => annotating}/bic/Makefile.am | 0
.../green/demo/{annoting => annotating}/bic/bic.cc | 0
.../green/demo/{annoting => annotating}/class.txt | 0
.../demo/{annoting => annotating}/lep/Makefile.am | 0
.../green/demo/{annoting => annotating}/lep/lep.cc | 0
.../{annoting => annotating}/nb_color/Makefile.am | 0
.../{annoting => annotating}/nb_color/nb_color.cc | 0
.../{annoting => annotating}/project/Makefile.am | 0
.../{annoting => annotating}/project/project.cc | 0
.../{annoting => annotating}/rgb_64/Makefile.am | 0
.../demo/{annoting => annotating}/rgb_64/rgb_64.cc | 0
.../{annoting => annotating}/rgb_64_9/Makefile.am | 0
.../{annoting => annotating}/rgb_64_9/rgb_64_9.cc | 0
.../stddev_color/Makefile.am | 0
.../stddev_color/stddev_color.cc | 0
.../{annoting => annotating}/nb_color/Makefile.am | 0
.../{annoting => annotating}/nb_color/nb_color.cc | 18 ++++----
.../stddev_color/Makefile.am | 0
.../stddev_color/stddev_color.cc | 18 ++++----
.../labeling/regional_maxima/regional_maxima.cc | 2 +-
milena/sandbox/green/mln/img_path.hh | 40 ++++++++++----------
22 files changed, 60 insertions(+), 39 deletions(-)
rename milena/sandbox/green/demo/{annoting => annotating}/bic/Makefile.am (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/bic/bic.cc (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/class.txt (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/lep/Makefile.am (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/lep/lep.cc (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/nb_color/Makefile.am (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/nb_color/nb_color.cc (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/project/Makefile.am (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/project/project.cc (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/rgb_64/Makefile.am (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/rgb_64/rgb_64.cc (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/rgb_64_9/Makefile.am (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/rgb_64_9/rgb_64_9.cc (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/stddev_color/Makefile.am (100%)
rename milena/sandbox/green/demo/{annoting => annotating}/stddev_color/stddev_color.cc (100%)
rename milena/sandbox/green/exp/{annoting => annotating}/nb_color/Makefile.am (100%)
rename milena/sandbox/green/exp/{annoting => annotating}/nb_color/nb_color.cc (91%)
rename milena/sandbox/green/exp/{annoting => annotating}/stddev_color/Makefile.am (100%)
rename milena/sandbox/green/exp/{annoting => annotating}/stddev_color/stddev_color.cc (91%)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index bc689d2..ffbc6e3 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,24 @@
+2009-12-16 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Correct typo into directories.
+
+ * green/demo/annoting: Rename as ...
+ * green/demo/annotating: ... these.
+
+ * green/exp/annoting: Rename as ...
+ * green/exp/annotating: ... these.
+
+ * green/mln/img_path.hh: Propagate mistake corrections.
+
+ * green/exp/labeling/regional_maxima/regional_maxima.cc (main):
+ Rename ANNOTING macro references as ANNOTATING ones.
+
+ * green/exp/annotating/stddev_color/stddev_color (main):
+ Rename ANNOTING macro references as ANNOTATING ones.
+
+ * green/exp/annotating/nb_color/nb_color.cc (main):
+ Rename ANNOTING macro references as ANNOTATING ones.
+
2009-12-15 green <jacquelet(a)lrde.epita.fr>
Introduce new image converter from color to greyscale.
diff --git a/milena/sandbox/green/demo/annoting/bic/Makefile.am b/milena/sandbox/green/demo/annotating/bic/Makefile.am
similarity index 100%
rename from milena/sandbox/green/demo/annoting/bic/Makefile.am
rename to milena/sandbox/green/demo/annotating/bic/Makefile.am
diff --git a/milena/sandbox/green/demo/annoting/bic/bic.cc b/milena/sandbox/green/demo/annotating/bic/bic.cc
similarity index 100%
rename from milena/sandbox/green/demo/annoting/bic/bic.cc
rename to milena/sandbox/green/demo/annotating/bic/bic.cc
diff --git a/milena/sandbox/green/demo/annoting/class.txt b/milena/sandbox/green/demo/annotating/class.txt
similarity index 100%
rename from milena/sandbox/green/demo/annoting/class.txt
rename to milena/sandbox/green/demo/annotating/class.txt
diff --git a/milena/sandbox/green/demo/annoting/lep/Makefile.am b/milena/sandbox/green/demo/annotating/lep/Makefile.am
similarity index 100%
rename from milena/sandbox/green/demo/annoting/lep/Makefile.am
rename to milena/sandbox/green/demo/annotating/lep/Makefile.am
diff --git a/milena/sandbox/green/demo/annoting/lep/lep.cc b/milena/sandbox/green/demo/annotating/lep/lep.cc
similarity index 100%
rename from milena/sandbox/green/demo/annoting/lep/lep.cc
rename to milena/sandbox/green/demo/annotating/lep/lep.cc
diff --git a/milena/sandbox/green/demo/annoting/nb_color/Makefile.am b/milena/sandbox/green/demo/annotating/nb_color/Makefile.am
similarity index 100%
rename from milena/sandbox/green/demo/annoting/nb_color/Makefile.am
rename to milena/sandbox/green/demo/annotating/nb_color/Makefile.am
diff --git a/milena/sandbox/green/demo/annoting/nb_color/nb_color.cc b/milena/sandbox/green/demo/annotating/nb_color/nb_color.cc
similarity index 100%
rename from milena/sandbox/green/demo/annoting/nb_color/nb_color.cc
rename to milena/sandbox/green/demo/annotating/nb_color/nb_color.cc
diff --git a/milena/sandbox/green/demo/annoting/project/Makefile.am b/milena/sandbox/green/demo/annotating/project/Makefile.am
similarity index 100%
rename from milena/sandbox/green/demo/annoting/project/Makefile.am
rename to milena/sandbox/green/demo/annotating/project/Makefile.am
diff --git a/milena/sandbox/green/demo/annoting/project/project.cc b/milena/sandbox/green/demo/annotating/project/project.cc
similarity index 100%
rename from milena/sandbox/green/demo/annoting/project/project.cc
rename to milena/sandbox/green/demo/annotating/project/project.cc
diff --git a/milena/sandbox/green/demo/annoting/rgb_64/Makefile.am b/milena/sandbox/green/demo/annotating/rgb_64/Makefile.am
similarity index 100%
rename from milena/sandbox/green/demo/annoting/rgb_64/Makefile.am
rename to milena/sandbox/green/demo/annotating/rgb_64/Makefile.am
diff --git a/milena/sandbox/green/demo/annoting/rgb_64/rgb_64.cc b/milena/sandbox/green/demo/annotating/rgb_64/rgb_64.cc
similarity index 100%
rename from milena/sandbox/green/demo/annoting/rgb_64/rgb_64.cc
rename to milena/sandbox/green/demo/annotating/rgb_64/rgb_64.cc
diff --git a/milena/sandbox/green/demo/annoting/rgb_64_9/Makefile.am b/milena/sandbox/green/demo/annotating/rgb_64_9/Makefile.am
similarity index 100%
rename from milena/sandbox/green/demo/annoting/rgb_64_9/Makefile.am
rename to milena/sandbox/green/demo/annotating/rgb_64_9/Makefile.am
diff --git a/milena/sandbox/green/demo/annoting/rgb_64_9/rgb_64_9.cc b/milena/sandbox/green/demo/annotating/rgb_64_9/rgb_64_9.cc
similarity index 100%
rename from milena/sandbox/green/demo/annoting/rgb_64_9/rgb_64_9.cc
rename to milena/sandbox/green/demo/annotating/rgb_64_9/rgb_64_9.cc
diff --git a/milena/sandbox/green/demo/annoting/stddev_color/Makefile.am b/milena/sandbox/green/demo/annotating/stddev_color/Makefile.am
similarity index 100%
rename from milena/sandbox/green/demo/annoting/stddev_color/Makefile.am
rename to milena/sandbox/green/demo/annotating/stddev_color/Makefile.am
diff --git a/milena/sandbox/green/demo/annoting/stddev_color/stddev_color.cc b/milena/sandbox/green/demo/annotating/stddev_color/stddev_color.cc
similarity index 100%
rename from milena/sandbox/green/demo/annoting/stddev_color/stddev_color.cc
rename to milena/sandbox/green/demo/annotating/stddev_color/stddev_color.cc
diff --git a/milena/sandbox/green/exp/annoting/nb_color/Makefile.am b/milena/sandbox/green/exp/annotating/nb_color/Makefile.am
similarity index 100%
rename from milena/sandbox/green/exp/annoting/nb_color/Makefile.am
rename to milena/sandbox/green/exp/annotating/nb_color/Makefile.am
diff --git a/milena/sandbox/green/exp/annoting/nb_color/nb_color.cc b/milena/sandbox/green/exp/annotating/nb_color/nb_color.cc
similarity index 91%
rename from milena/sandbox/green/exp/annoting/nb_color/nb_color.cc
rename to milena/sandbox/green/exp/annotating/nb_color/nb_color.cc
index 6dd9c26..e46c8c2 100644
--- a/milena/sandbox/green/exp/annoting/nb_color/nb_color.cc
+++ b/milena/sandbox/green/exp/annotating/nb_color/nb_color.cc
@@ -80,15 +80,15 @@ int main()
//typedef boost::filesystem::initial_path<t_path()> t_init_path;
typedef boost::filesystem::directory_iterator t_iter_path;
- t_path full_path[] = {t_path(ANNOTING_BILL_IMG_PATH),
- t_path(ANNOTING_FAX_IMG_PATH),
- t_path(ANNOTING_HANDWRITTEN_IMG_PATH),
- t_path(ANNOTING_LOGO_IMG_PATH),
- t_path(ANNOTING_MAP_IMG_PATH),
- t_path(ANNOTING_PHOTO_IMG_PATH),
- t_path(ANNOTING_SCREENSHOT_IMG_PATH),
- t_path(ANNOTING_SLIDE_IMG_PATH),
- t_path(ANNOTING_TYPED_IMG_PATH)};
+ t_path full_path[] = {t_path(ANNOTATING_BILL_IMG_PATH),
+ t_path(ANNOTATING_FAX_IMG_PATH),
+ t_path(ANNOTATING_HANDWRITTEN_IMG_PATH),
+ t_path(ANNOTATING_LOGO_IMG_PATH),
+ t_path(ANNOTATING_MAP_IMG_PATH),
+ t_path(ANNOTATING_PHOTO_IMG_PATH),
+ t_path(ANNOTATING_SCREENSHOT_IMG_PATH),
+ t_path(ANNOTATING_SLIDE_IMG_PATH),
+ t_path(ANNOTATING_TYPED_IMG_PATH)};
for (int i = 0; i < 9; ++i)
{
diff --git a/milena/sandbox/green/exp/annoting/stddev_color/Makefile.am b/milena/sandbox/green/exp/annotating/stddev_color/Makefile.am
similarity index 100%
rename from milena/sandbox/green/exp/annoting/stddev_color/Makefile.am
rename to milena/sandbox/green/exp/annotating/stddev_color/Makefile.am
diff --git a/milena/sandbox/green/exp/annoting/stddev_color/stddev_color.cc b/milena/sandbox/green/exp/annotating/stddev_color/stddev_color.cc
similarity index 91%
rename from milena/sandbox/green/exp/annoting/stddev_color/stddev_color.cc
rename to milena/sandbox/green/exp/annotating/stddev_color/stddev_color.cc
index 652b8a8..aee3c5d 100644
--- a/milena/sandbox/green/exp/annoting/stddev_color/stddev_color.cc
+++ b/milena/sandbox/green/exp/annotating/stddev_color/stddev_color.cc
@@ -102,15 +102,15 @@ int main()
typedef boost::filesystem::path t_path;
typedef boost::filesystem::directory_iterator t_iter_path;
- t_path full_path[] = {t_path(ANNOTING_BILL_IMG_PATH),
- t_path(ANNOTING_FAX_IMG_PATH),
- t_path(ANNOTING_HANDWRITTEN_IMG_PATH),
- t_path(ANNOTING_LOGO_IMG_PATH),
- t_path(ANNOTING_MAP_IMG_PATH),
- t_path(ANNOTING_PHOTO_IMG_PATH),
- t_path(ANNOTING_SCREENSHOT_IMG_PATH),
- t_path(ANNOTING_SLIDE_IMG_PATH),
- t_path(ANNOTING_TYPED_IMG_PATH)};
+ t_path full_path[] = {t_path(ANNOTATING_BILL_IMG_PATH),
+ t_path(ANNOTATING_FAX_IMG_PATH),
+ t_path(ANNOTATING_HANDWRITTEN_IMG_PATH),
+ t_path(ANNOTATING_LOGO_IMG_PATH),
+ t_path(ANNOTATING_MAP_IMG_PATH),
+ t_path(ANNOTATING_PHOTO_IMG_PATH),
+ t_path(ANNOTATING_SCREENSHOT_IMG_PATH),
+ t_path(ANNOTATING_SLIDE_IMG_PATH),
+ t_path(ANNOTATING_TYPED_IMG_PATH)};
for (int i = 0; i < 9; ++i)
{
diff --git a/milena/sandbox/green/exp/labeling/regional_maxima/regional_maxima.cc b/milena/sandbox/green/exp/labeling/regional_maxima/regional_maxima.cc
index a66c1b7..69fabd0 100644
--- a/milena/sandbox/green/exp/labeling/regional_maxima/regional_maxima.cc
+++ b/milena/sandbox/green/exp/labeling/regional_maxima/regional_maxima.cc
@@ -115,7 +115,7 @@ int main()
//typedef boost::filesystem::initial_path<t_path()> t_init_path;
typedef boost::filesystem::directory_iterator t_iter_path;
- t_path full_path(ANNOTING_TYPED_IMG_PATH);
+ t_path full_path(ANNOTATING_TYPED_IMG_PATH);
std::cout << "entering " << full_path << std::endl;
diff --git a/milena/sandbox/green/mln/img_path.hh b/milena/sandbox/green/mln/img_path.hh
index 04ff0c5..7368c22 100644
--- a/milena/sandbox/green/mln/img_path.hh
+++ b/milena/sandbox/green/mln/img_path.hh
@@ -42,27 +42,27 @@
# define SCRIBO_PGM_IMG_PATH SCRIBO_IMG_PATH"/pgm_50p"
# define SCRIBO_PPM_IMG_PATH SCRIBO_IMG_PATH"/ppm_50p"
-# define ANNOTING_IMG_PATH IMG_PATH"/annoting"
-# define ANNOTING_BILL_IMG_PATH ANNOTING_IMG_PATH"/bill"
-# define ANNOTING_FAX_IMG_PATH ANNOTING_IMG_PATH"/fax"
-# define ANNOTING_HANDWRITTEN_IMG_PATH ANNOTING_IMG_PATH"/handwritten"
-# define ANNOTING_LOGO_IMG_PATH ANNOTING_IMG_PATH"/logo"
-# define ANNOTING_MAP_IMG_PATH ANNOTING_IMG_PATH"/map"
-# define ANNOTING_SCREENSHOT_IMG_PATH ANNOTING_IMG_PATH"/screenshot"
-# define ANNOTING_SLIDE_IMG_PATH ANNOTING_IMG_PATH"/slide"
-# define ANNOTING_TYPED_IMG_PATH ANNOTING_IMG_PATH"/typed"
-# define ANNOTING_PHOTO_IMG_PATH ANNOTING_IMG_PATH"/photo"
+# define ANNOTATING_IMG_PATH IMG_PATH"/annotating"
+# define ANNOTATING_BILL_IMG_PATH ANNOTATING_IMG_PATH"/bill"
+# define ANNOTATING_FAX_IMG_PATH ANNOTATING_IMG_PATH"/fax"
+# define ANNOTATING_HANDWRITTEN_IMG_PATH ANNOTATING_IMG_PATH"/handwritten"
+# define ANNOTATING_LOGO_IMG_PATH ANNOTATING_IMG_PATH"/logo"
+# define ANNOTATING_MAP_IMG_PATH ANNOTATING_IMG_PATH"/map"
+# define ANNOTATING_SCREENSHOT_IMG_PATH ANNOTATING_IMG_PATH"/screenshot"
+# define ANNOTATING_SLIDE_IMG_PATH ANNOTATING_IMG_PATH"/slide"
+# define ANNOTATING_TYPED_IMG_PATH ANNOTATING_IMG_PATH"/typed"
+# define ANNOTATING_PHOTO_IMG_PATH ANNOTATING_IMG_PATH"/photo"
// result directories
-# define RESULT_ANNOTING_PATH RESULT_PATH"/annoting"
-# define RESULT_ANNOTING_BILL_PATH RESULT_ANNOTING_PATH"/bill"
-# define RESULT_ANNOTING_FAX_PATH RESULT_ANNOTING_PATH"/fax"
-# define RESULT_ANNOTING_HANDWRITTEN_PATH RESULT_ANNOTING_PATH"/handwritten"
-# define RESULT_ANNOTING_LOGO_PATH RESULT_ANNOTING_PATH"/logo"
-# define RESULT_ANNOTING_MAP_PATH RESULT_ANNOTING_PATH"/map"
-# define RESULT_ANNOTING_SCREENSHOT_PATH RESULT_ANNOTING_PATH"/screenshot"
-# define RESULT_ANNOTING_SLIDE_PATH RESULT_ANNOTING_PATH"/slide"
-# define RESULT_ANNOTING_TYPED_PATH RESULT_ANNOTING_PATH"/typed"
-# define RESULT_ANNOTING_PHOTO_PATH RESULT_ANNOTING_PATH"/photo"
+# define RESULT_ANNOTATING_PATH RESULT_PATH"/annotating"
+# define RESULT_ANNOTATING_BILL_PATH RESULT_ANNOTATING_PATH"/bill"
+# define RESULT_ANNOTATING_FAX_PATH RESULT_ANNOTATING_PATH"/fax"
+# define RESULT_ANNOTATING_HANDWRITTEN_PATH RESULT_ANNOTATING_PATH"/handwritten"
+# define RESULT_ANNOTATING_LOGO_PATH RESULT_ANNOTATING_PATH"/logo"
+# define RESULT_ANNOTATING_MAP_PATH RESULT_ANNOTATING_PATH"/map"
+# define RESULT_ANNOTATING_SCREENSHOT_PATH RESULT_ANNOTATING_PATH"/screenshot"
+# define RESULT_ANNOTATING_SLIDE_PATH RESULT_ANNOTATING_PATH"/slide"
+# define RESULT_ANNOTATING_TYPED_PATH RESULT_ANNOTATING_PATH"/typed"
+# define RESULT_ANNOTATING_PHOTO_PATH RESULT_ANNOTATING_PATH"/photo"
#endif // ! MLN_IMG_PATH_HH
--
1.5.6.5
1
0

24 Feb '10
Introduce new image converter from color to greyscale.
* green/mln/fun/v2v/rgb8_to_int_u8.hh: New image converter.
---
milena/sandbox/ChangeLog | 6 ++++
.../{int_u16_to_int_u14.hh => rgb8_to_int_u8.hh} | 32 ++++++++++----------
2 files changed, 22 insertions(+), 16 deletions(-)
copy milena/sandbox/green/mln/fun/v2v/{int_u16_to_int_u14.hh => rgb8_to_int_u8.hh} (75%)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 3863ada..bc689d2 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,11 @@
2009-12-15 green <jacquelet(a)lrde.epita.fr>
+ Introduce new image converter from color to greyscale.
+
+ * green/mln/fun/v2v/rgb8_to_int_u8.hh: New image converter.
+
+2009-12-15 green <jacquelet(a)lrde.epita.fr>
+
Add new image paths to use the annoting database.
* green/mln/img_path.hh: Update to LRDE norm and add annoting database.
diff --git a/milena/sandbox/green/mln/fun/v2v/int_u16_to_int_u14.hh b/milena/sandbox/green/mln/fun/v2v/rgb8_to_int_u8.hh
similarity index 75%
copy from milena/sandbox/green/mln/fun/v2v/int_u16_to_int_u14.hh
copy to milena/sandbox/green/mln/fun/v2v/rgb8_to_int_u8.hh
index e7f4755..0f63c8c 100644
--- a/milena/sandbox/green/mln/fun/v2v/int_u16_to_int_u14.hh
+++ b/milena/sandbox/green/mln/fun/v2v/rgb8_to_int_u8.hh
@@ -25,47 +25,47 @@
// exception does not however invalidate any other reasons why the
// executable file might be covered by the GNU General Public License.
-#ifndef MLN_FUN_V2V_INT_U16_TO_INT_U14_HH
-#define MLN_FUN_V2V_INT_U16_TO_INT_U14_HH
+#ifndef MLN_FUN_V2V_RGB8_TO_INT_U8_HH
+# define MLN_FUN_V2V_RGB8_TO_INT_U8_HH
-#include <mln/value/int_u16.hh>
-#include <mln/value/int_u.hh>
+# include <mln/value/int_u8.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/core/contract.hh>
/// \file
///
-/// \brief Convert int_u16 value to int_u14.
+/// \brief Convert rgb8 color value to int_u8 grey value
namespace mln
{
namespace fun
{
-
+
namespace v2v
{
- /// \brief Convert int_u16 value to int_u14.
+ /// \brief Convert rgb8 color value to int_u8 grey value
///
/// \ingroup modfunv2v
- struct int_u16_to_int_u14 : Function_v2v< int_u16_to_int_u14 >
+ struct rgb8_to_int_u8 : Function_v2v<rgb8_to_int_u8>
{
- typedef value::int_u16 argument;
- typedef value::int_u<14> result;
-
+ typedef value::rgb8 argument;
+ typedef value::int_u8 result;
+
result operator()(const argument& c) const
{
- result res(c / 4);
-
+ result res((c.red() + c.green() + c.blue()) / 3);
+
return res;
}
};
}
-
+
}
}
-
-#endif // ! MLN_FUN_V2V_INT_U16_TO_INT_U14_HH
+#endif // ! MLN_FUN_V2V_RGB8_TO_INT_U8_HH
--
1.5.6.5
1
0

24 Feb '10
Add new image paths to use the annoting database.
* green/mln/img_path.hh: Update to LRDE norm and add annoting database.
---
milena/sandbox/ChangeLog | 26 +++++++++++++++++
milena/sandbox/green/mln/img_path.hh | 52 +++++++++++++++++++++-------------
2 files changed, 58 insertions(+), 20 deletions(-)
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index db8bd10..3863ada 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,29 @@
+2009-12-15 green <jacquelet(a)lrde.epita.fr>
+
+ Add new image paths to use the annoting database.
+
+ * green/mln/img_path.hh: Update to LRDE norm and add annoting database.
+
+2009-12-15 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Work around the regional labeling chain and experiment it on the
+ annoting database.
+
+ * green/exp/labeling/regional_maxima/Makefile.am: Add boost library.
+ * green/exp/labeling/regional_maxima/regional_maxima.cc: Count colors.
+
+2009-12-15 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
+
+ Test clipart operators described by Millet on annoting database.
+
+ * green/exp/annoting/nb_color: New experimentation directory.
+ * green/exp/annoting/nb_color/Makefile.am: New Makefile.
+ * green/exp/annoting/nb_color/nb_color.cc: New experementation.
+
+ * green/exp/annoting/stddev_color: New experimentation directory.
+ * green/exp/annoting/stddev_color/Makefile.am: New Makefile.
+ * green/exp/annoting/stddev_color/stddev_color.cc: New experimentation.
+
2009-12-15 Yann Jacquelet <jacquelet(a)lrde.epita.fr>
Introduce clipart operators described by Millet.
diff --git a/milena/sandbox/green/mln/img_path.hh b/milena/sandbox/green/mln/img_path.hh
index 188b813..04ff0c5 100644
--- a/milena/sandbox/green/mln/img_path.hh
+++ b/milena/sandbox/green/mln/img_path.hh
@@ -26,31 +26,43 @@
// executable file might be covered by the GNU General Public License.
#ifndef MLN_IMG_PATH_HH
-#define MLN_IMG_PATH_HH
+# define MLN_IMG_PATH_HH
-#define IMG_PATH "/home/green/svn/oln/trunk/milena/sandbox/green/img"
+# define IMG_PATH "/home/green/svn/oln/trunk/milena/sandbox/green/img"
+# define RESULT_PATH "/home/green/svn/oln/trunk/milena/sandbox/green/result"
-#define INIM_IMG_PATH IMG_PATH"/inim"
-#define INIM_FG_BG_IMG_PATH INIM_IMG_PATH"/fg_bg"
-#define INIM_IN_IMG_PATH INIM_IMG_PATH"/in"
+# define INIM_IMG_PATH IMG_PATH"/inim"
+# define INIM_FG_BG_IMG_PATH INIM_IMG_PATH"/fg_bg"
+# define INIM_IN_IMG_PATH INIM_IMG_PATH"/in"
-#define OLENA_IMG_PATH IMG_PATH"/olena"
+# define OLENA_IMG_PATH IMG_PATH"/olena"
-#define SCRIBO_IMG_PATH IMG_PATH"/scribo"
-#define SCRIBO_JPG_IMG_PATH SCRIBO_IMG_PATH"/jpg_50p"
-#define SCRIBO_PGM_IMG_PATH SCRIBO_IMG_PATH"/pgm_50p"
-#define SCRIBO_PPM_IMG_PATH SCRIBO_IMG_PATH"/ppm_50p"
-
-#define ANNOTING_IMG_PATH IMG_PATH"/annoting"
-#define ANNOTING_BILL_IMG_PATH ANNOTING_IMG_PATH"/bill"
-#define ANNOTING_FAX_IMG_PATH ANNOTING_IMG_PATH"/fax"
-#define ANNOTING_HANDWRITTEN_IMG_PATH ANNOTING_IMG_PATH"/handwritten"
-#define ANNOTING_LOGO_IMG_PATH ANNOTING_IMG_PATH"/logo"
-#define ANNOTING_MAP_IMG_PATH ANNOTING_IMG_PATH"/map"
-#define ANNOTING_SCREENSHOT_IMG_PATH ANNOTING_IMG_PATH"/screenshot"
-#define ANNOTING_SLIDE_IMG_PATH ANNOTING_IMG_PATH"/slide"
-#define ANNOTING_TYPED_IMG_PATH ANNOTING_IMG_PATH"/typed"
+# define SCRIBO_IMG_PATH IMG_PATH"/scribo"
+# define SCRIBO_JPG_IMG_PATH SCRIBO_IMG_PATH"/jpg_50p"
+# define SCRIBO_PGM_IMG_PATH SCRIBO_IMG_PATH"/pgm_50p"
+# define SCRIBO_PPM_IMG_PATH SCRIBO_IMG_PATH"/ppm_50p"
+# define ANNOTING_IMG_PATH IMG_PATH"/annoting"
+# define ANNOTING_BILL_IMG_PATH ANNOTING_IMG_PATH"/bill"
+# define ANNOTING_FAX_IMG_PATH ANNOTING_IMG_PATH"/fax"
+# define ANNOTING_HANDWRITTEN_IMG_PATH ANNOTING_IMG_PATH"/handwritten"
+# define ANNOTING_LOGO_IMG_PATH ANNOTING_IMG_PATH"/logo"
+# define ANNOTING_MAP_IMG_PATH ANNOTING_IMG_PATH"/map"
+# define ANNOTING_SCREENSHOT_IMG_PATH ANNOTING_IMG_PATH"/screenshot"
+# define ANNOTING_SLIDE_IMG_PATH ANNOTING_IMG_PATH"/slide"
+# define ANNOTING_TYPED_IMG_PATH ANNOTING_IMG_PATH"/typed"
+# define ANNOTING_PHOTO_IMG_PATH ANNOTING_IMG_PATH"/photo"
+// result directories
+# define RESULT_ANNOTING_PATH RESULT_PATH"/annoting"
+# define RESULT_ANNOTING_BILL_PATH RESULT_ANNOTING_PATH"/bill"
+# define RESULT_ANNOTING_FAX_PATH RESULT_ANNOTING_PATH"/fax"
+# define RESULT_ANNOTING_HANDWRITTEN_PATH RESULT_ANNOTING_PATH"/handwritten"
+# define RESULT_ANNOTING_LOGO_PATH RESULT_ANNOTING_PATH"/logo"
+# define RESULT_ANNOTING_MAP_PATH RESULT_ANNOTING_PATH"/map"
+# define RESULT_ANNOTING_SCREENSHOT_PATH RESULT_ANNOTING_PATH"/screenshot"
+# define RESULT_ANNOTING_SLIDE_PATH RESULT_ANNOTING_PATH"/slide"
+# define RESULT_ANNOTING_TYPED_PATH RESULT_ANNOTING_PATH"/typed"
+# define RESULT_ANNOTING_PHOTO_PATH RESULT_ANNOTING_PATH"/photo"
#endif // ! MLN_IMG_PATH_HH
--
1.5.6.5
1
0