* icdar/2009/hsc/icdar2ppm.cc,
* icdar/2009/hsc/icdar2ppm.hh: new tool to convert icdar .dat files to
ppm.
---
milena/sandbox/ChangeLog | 8 ++++++
milena/sandbox/icdar/2009/hsc/icdar2ppm.cc | 16 ++++++++++++
milena/sandbox/icdar/2009/hsc/icdar2ppm.hh | 35 ++++++++++++++++++++++++++++
3 files changed, 59 insertions(+), 0 deletions(-)
create mode 100644 milena/sandbox/icdar/2009/hsc/icdar2ppm.cc
create mode 100644 milena/sandbox/icdar/2009/hsc/icdar2ppm.hh
diff --git a/milena/sandbox/ChangeLog b/milena/sandbox/ChangeLog
index c6a6156..681b6bf 100644
--- a/milena/sandbox/ChangeLog
+++ b/milena/sandbox/ChangeLog
@@ -1,5 +1,13 @@
2009-04-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+ Add icdar2ppm.
+
+ * icdar/2009/hsc/icdar2ppm.cc,
+ * icdar/2009/hsc/icdar2ppm.hh: new tool to convert icdar .dat files to
+ ppm.
+
+2009-04-07 Guillaume Lazzara <z(a)lrde.epita.fr>
+
Update ICDAR code.
* icdar/2009/hsc/lines_to_words.cc: Move some code...
diff --git a/milena/sandbox/icdar/2009/hsc/icdar2ppm.cc
b/milena/sandbox/icdar/2009/hsc/icdar2ppm.cc
new file mode 100644
index 0000000..c4ba321
--- /dev/null
+++ b/milena/sandbox/icdar/2009/hsc/icdar2ppm.cc
@@ -0,0 +1,16 @@
+#include "icdar2ppm.hh"
+
+int main(int argc, char *argv[])
+{
+ if (argc < 3)
+ {
+ std::cout << "Usage: " << argv[0] << "
<input.pbm> <input.dat> <output.ppm>" << std::endl
+ << " HSC @ ICDAR'2009" << std::endl
+ << "input.pbm The original image. It is used to get the image
dimension." << std::endl
+ << "input.dat The \"Ground truth\" data" <<
std::endl
+ << "output.ppm The PPM version of input.dat." << std::endl;
+ return 1;
+ }
+
+ mln::icdar2ppm(argv[1], argv[2], argv[3]);
+}
diff --git a/milena/sandbox/icdar/2009/hsc/icdar2ppm.hh
b/milena/sandbox/icdar/2009/hsc/icdar2ppm.hh
new file mode 100644
index 0000000..eca8c84
--- /dev/null
+++ b/milena/sandbox/icdar/2009/hsc/icdar2ppm.hh
@@ -0,0 +1,35 @@
+#ifndef ICDAR2PPM_HH
+# define ICDAR2PPM_HH
+
+# include <mln/core/image/image2d.hh>
+# include <mln/value/label_8.hh>
+# include <mln/value/rgb8.hh>
+# include <mln/level/compute.hh>
+# include <mln/accu/count_labels.hh>
+# include <mln/debug/colorize.hh>
+# include <mln/io/ppm/save.hh>
+# include <mln/io/pbm/load.hh>
+
+# include "io/icdar/load.hh"
+
+namespace mln
+{
+
+ void
+ icdar2ppm(const std::string& pbmfile, const std::string& icdarfile,
+ const std::string& ppmfile)
+ {
+ image2d<bool> ref;
+ io::pbm::load(ref, pbmfile);
+
+ image2d<value::label_8> ima;
+ io::icdar::load(ima, icdarfile, ref.nrows(), ref.ncols());
+
+ value::label_8 nlines = level::compute(accu::meta::count_labels(), ima);
+
+ io::ppm::save(debug::colorize(value::rgb8(), ima, nlines), ppmfile);
+ }
+
+}
+
+#endif // ! ICDAR2PPM_HH
--
1.5.6.5
Show replies by date