Commit e8373a06 authored by Guillaume Lazzara's avatar Guillaume Lazzara
Browse files

Add a fast rotation tool.

	* scribo/src/preprocessing/Makefile.am,
	* scribo/src/preprocessing/rotate_90.cc: New.
parent 4bf89fb7
2010-06-15 Guillaume Lazzara <z@lrde.epita.fr>
Add a fast rotation tool.
* scribo/src/preprocessing/Makefile.am,
* scribo/src/preprocessing/rotate_90.cc: New.
2010-06-15 Guillaume Lazzara <z@lrde.epita.fr>
Add a new routine to highlight text areas in an image.
......
......@@ -37,6 +37,16 @@ unskew_SOURCES = unskew.cc
if HAVE_MAGICKXX
bin_PROGRAMS += rotate_90
rotate_90_SOURCES = rotate_90.cc
rotate_90_CPPFLAGS = $(AM_CPPFLAGS) \
$(TESSERACT_CPPFLAGS) \
`Magick++-config --cppflags`
rotate_90_LDFLAGS = $(AM_LDFLAGS) \
$(TESSERACT_LDFLAGS) \
-lpthread `Magick++-config --libs`
bin_PROGRAMS += to_pgm
to_pgm_SOURCES = to_pgm.cc
to_pgm_CPPFLAGS = $(AM_CPPFLAGS) \
......
#include <mln/core/image/image2d.hh>
#include <mln/value/rgb8.hh>
#include <mln/io/magick/load.hh>
#include <mln/io/ppm/save.hh>
#include <mln/util/timer.hh>
#include <scribo/debug/usage.hh>
#include <scribo/preprocessing/rotate_90.hh>
const char *args_desc[][2] =
{
{ "input.*", "An image." },
{ "output.ppm", "A rotated image." },
{ "positive", "if set to 1, performs a +90 rotation; -90 otherwise. (default: 0)" },
{0, 0}
};
int main(int argc, char *argv[])
{
using namespace mln;
if (argc != 3 && argc != 4)
return scribo::debug::usage(argv,
"Fast +90/-90 rotation",
"input.* output.ppm",
args_desc);
typedef image2d<value::rgb8> I;
I ima;
io::magick::load(ima, argv[1]);
bool positive = false;
if (argc >= 4)
positive = (atoi(argv[3]) != 0);
mln::util::timer t;
t.start();
image2d<value::rgb8> out = scribo::preprocessing::rotate_90(ima, positive);
t.stop();
std::cout << t << std::endl;
io::ppm::save(out, argv[2]);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment