* bin/labeling/colorize.cc,
* bin/pgm_to_pbm.cc,
* bin/ppm_negate.cc: New.
---
milena/sandbox/ChangeLog | 8 ++++++
milena/sandbox/bin/labeling/colorize.cc | 24 +++++++++++++++++
milena/sandbox/bin/pgm_to_pbm.cc | 39 ++++++++++++++++++++++++++++
milena/sandbox/bin/ppm_negate.cc | 43 +++++++++++++++++++++++++++++++
4 files changed, 114 insertions(+), 0 deletions(-)
create mode 100644 milena/sandbox/bin/labeling/colorize.cc
create mode 100644 milena/sandbox/bin/pgm_to_pbm.cc
create mode 100644 milena/sandbox/bin/ppm_negate.cc
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index 9e7f25b..bed29e7 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,3 +1,11 @@
+2010-02-16 Guillaume Lazzara <z(a)lrde.epita.fr>
+
+ Add new tools in bin sandbox.
+
+ * bin/labeling/colorize.cc,
+ * bin/pgm_to_pbm.cc,
+ * bin/ppm_negate.cc: New.
+
2009-11-17 Thierry Geraud <thierry.geraud(a)lrde.epita.fr>
Add some bench + canvas + subsampling + browsing code.
diff --git a/milena/sandbox/bin/labeling/colorize.cc
b/milena/sandbox/bin/labeling/colorize.cc
new file mode 100644
index 0000000..8a548c1
--- /dev/null
+++ b/milena/sandbox/bin/labeling/colorize.cc
@@ -0,0 +1,24 @@
+#include <mln/core/concept/function.hh>
+#include <mln/core/image/image2d.hh>
+
+#include <mln/value/rgb8.hh>
+#include <mln/value/label_8.hh>
+#include <mln/io/ppm/save.hh>
+#include <mln/io/pgm/load.hh>
+
+#include <mln/labeling/colorize.hh>
+
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+
+ if (argc < 3)
+ std::cout << "Usage : " << argv[0]
+ << " input_label_8.pgm out.ppm" << std::endl;
+
+ image2d<value::label_8> input;
+ io::pgm::load(input, argv[1]);
+
+ io::ppm::save(labeling::colorize(value::rgb8(), input), argv[2]);
+}
diff --git a/milena/sandbox/bin/pgm_to_pbm.cc b/milena/sandbox/bin/pgm_to_pbm.cc
new file mode 100644
index 0000000..9470e39
--- /dev/null
+++ b/milena/sandbox/bin/pgm_to_pbm.cc
@@ -0,0 +1,39 @@
+#include <mln/core/image/image2d.hh>
+#include <mln/core/concept/function.hh>
+#include <mln/io/pgm/load.hh>
+#include <mln/io/pbm/save.hh>
+#include <mln/data/transform.hh>
+#include <mln/value/int_u8.hh>
+
+namespace mln
+{
+
+ struct to_bin : public Function_v2v<to_bin>
+ {
+ typedef bool result;
+
+ bool operator()(const value::int_u8& v) const
+ {
+ return v != 0;
+ }
+
+ };
+
+}
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+
+ if (argc < 3)
+ {
+ std::cout << "Usage: " << argv[1] << " input.pgm
out.pbm" << std::endl;
+ return 1;
+ }
+
+ image2d<value::int_u8> input;
+ io::pgm::load(input, argv[1]);
+
+ to_bin f;
+ io::pbm::save(data::transform(input, f), argv[2]);
+}
diff --git a/milena/sandbox/bin/ppm_negate.cc b/milena/sandbox/bin/ppm_negate.cc
new file mode 100644
index 0000000..e702224
--- /dev/null
+++ b/milena/sandbox/bin/ppm_negate.cc
@@ -0,0 +1,43 @@
+#include <mln/core/concept/function.hh>
+#include <mln/core/image/image2d.hh>
+#include <mln/value/rgb8.hh>
+#include <mln/io/ppm/all.hh>
+#include <mln/arith/revert.hh>
+#include <mln/data/transform.hh>
+
+namespace mln
+{
+
+ struct rgb_negate : Function_v2v<rgb_negate>
+ {
+ typedef value::rgb8 result;
+
+ result operator()(const value::rgb8& v) const
+ {
+ value::rgb8 tmp(255 - v.red(), 255 - v.green(), 255 - v.blue());
+ return tmp;
+ }
+
+ };
+
+} // end of namespace mln
+
+
+
+int main(int argc, char *argv[])
+{
+ using namespace mln;
+
+ if (argc < 3)
+ {
+ std::cout << "Usage: " << argv[0] << " input.ppm
output.ppm"
+ << std::endl;
+ return 1;
+ }
+
+ image2d<value::rgb8> input;
+ io::ppm::load(input, argv[1]);
+
+ io::ppm::save(data::transform(input, rgb_negate()), argv[2]);
+}
+
--
1.5.6.5