URL:
https://svn.lrde.epita.fr/svn/oln/trunk/milena
ChangeLog:
2008-03-04 Caroline Vigouroux <vigour_c(a)epita.fr>
test conversion with lena image.
* color/rgb_to_hsi.hh: .
* load.cc: test.
---
color/rgb_to_hsi.hh | 8 ++++----
load.cc | 38 ++++++++++++++++++++++++++++++--------
2 files changed, 34 insertions(+), 12 deletions(-)
Index: trunk/milena/sandbox/vigouroux/load.cc
===================================================================
--- trunk/milena/sandbox/vigouroux/load.cc (revision 1761)
+++ trunk/milena/sandbox/vigouroux/load.cc (revision 1762)
@@ -1,5 +1,7 @@
#include <mln/core/image2d.hh>
#include <mln/value/int_u8.hh>
+#include "color/my_hsi.hh"
+#include "color/rgb_to_hsi.hh"
#include <mln/display/save_and_show.hh>
#include <mln/value/rgb.hh>
#include <mln/value/rgb8.hh>
@@ -16,23 +18,43 @@
# include <mln/display/save.hh>
# include <mln/display/show.hh>
+#include <mln/core/image2d.hh>
+#include <mln/win/rectangle2d.hh>
+#include <mln/make/pixel.hh>
+
+#include <iostream>
+
+template <typename I, typename O, typename W>
+void test_fill(I& ima, O& out, W& win)
+{
+ mln::value::hsi_3x8 c_hsi;
+ mln::value::rgb8 c2;
+ mln_piter(I) p(out.domain());
+ mln_qixter(I, W) q(ima, win, p);
+ for_all(p)
+ {
+ for_all(q)
+ {
+ c_hsi = mln::fun::v2v::f_rgb_to_hsi_3x8(q.val());
+ c2 = mln::fun::v2v::f_hsi_to_rgb_3x8(c_hsi);
+ }
+ out(p) = c2;
+ }
+}
+
int main()
{
using namespace mln;
using value::int_u8;
image2d<mln::value::rgb8> lena;
io::ppm::load(lena, "../../img/lena.ppm");
-// image2d<mln::value::hsi_3x8> inter(lena.domain());
+ image2d<mln::value::hsi_3x8> inter(lena.domain());
image2d<mln::value::rgb8> out(lena.domain());
const image2d<mln::value::rgb8> input = exact(lena);
-// mln_piter(image2d<mln::value::rgb8>) p(input.domain());
-// for_all(p)
-// {
-// inter(p) = fun::v2v::f_rgb_to_hsi_3x8(p);
-
-// }
+ win::rectangle2d rect(3, 3);
+ test_fill(input, out, rect);
- display::save_and_show (lena, "display", 1);
+ display::save_and_show (out, "display", 50);
}
Index: trunk/milena/sandbox/vigouroux/color/rgb_to_hsi.hh
===================================================================
--- trunk/milena/sandbox/vigouroux/color/rgb_to_hsi.hh (revision 1761)
+++ trunk/milena/sandbox/vigouroux/color/rgb_to_hsi.hh (revision 1762)
@@ -45,10 +45,10 @@
float tmp = atan2(beta, alpha) / 3.1415 * 180.0;
- if (tmp < 0 or tmp > 1)
- {
- std::cout << "FIXME: " << tmp << std::endl;
- }
+// if (tmp < 0 or tmp > 1)
+// {
+// std::cout << "FIXME: " << tmp << std::endl;
+// }
hsi.hue() = atan2(beta, alpha) / 3.1415 * 180.0;
if (hsi.hue() < 0)