---
scribo/sandbox/ChangeLog | 4 ++
scribo/sandbox/z/sauvola_ms_rv/dump_color_sign.cc | 52 +++++++++++++++++++++
2 files changed, 56 insertions(+), 0 deletions(-)
create mode 100644 scribo/sandbox/z/sauvola_ms_rv/dump_color_sign.cc
diff --git a/scribo/sandbox/ChangeLog b/scribo/sandbox/ChangeLog
index 92abdb1..2c0068f 100644
--- a/scribo/sandbox/ChangeLog
+++ b/scribo/sandbox/ChangeLog
@@ -1,5 +1,9 @@
2012-08-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+ * z/sauvola_ms_rv/dump_color_sign.cc: New.
+
+2012-08-23 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Add test images.
* z/sauvola_ms_rv/img/001.pgm,
diff --git a/scribo/sandbox/z/sauvola_ms_rv/dump_color_sign.cc
b/scribo/sandbox/z/sauvola_ms_rv/dump_color_sign.cc
new file mode 100644
index 0000000..6ea6ad8
--- /dev/null
+++ b/scribo/sandbox/z/sauvola_ms_rv/dump_color_sign.cc
@@ -0,0 +1,52 @@
+#include <mln/core/concept/function.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/io/dump/load.hh>
+#include <mln/io/ppm/save.hh>
+#include <mln/data/transform.hh>
+#include <mln/data/stretch.hh>
+#include <mln/arith/minus.hh>
+
+namespace mln
+{
+
+ struct color_diff : Function_v2v<color_diff>
+ {
+ typedef value::rgb8 result;
+
+ value::rgb8 operator()(const int& v) const
+ {
+ int v_d2 = std::abs(v) * 0.0001;
+
+ if (v < 0)
+ return value::rgb8(128 + v_d2, v_d2, v_d2);
+ else if (v > 0)
+ return value::rgb8(v_d2, 128 + v_d2, v_d2);
+ else
+ return value::rgb8(255, 255, 255);
+ }
+ };
+
+}
+
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+
+
+ if (argc != 3)
+ {
+ std::cout << "Usage: " << argv[0] << " in.dump
out.ppm" << std::endl;
+ return 1;
+ }
+
+ image2d<double> input;
+
+ io::dump::load(input, argv[1]);
+
+ color_diff f;
+ image2d<value::rgb8> result = data::transform(input, f);
+
+ io::ppm::save(result, argv[2]);
+}
--
1.7.2.5
Show replies by date