last-svn-commit-441-g8fed6fb Add a new rotation tool.

* src/preprocessing/Makefile.am: Add a new target. * src/preprocessing/rotate.cc: New. --- scribo/ChangeLog | 8 ++++++ scribo/src/preprocessing/Makefile.am | 9 ++++++ .../src/preprocessing/{subsample.cc => rotate.cc} | 27 ++++++++++--------- 3 files changed, 31 insertions(+), 13 deletions(-) copy scribo/src/preprocessing/{subsample.cc => rotate.cc} (80%) diff --git a/scribo/ChangeLog b/scribo/ChangeLog index 9882ea6..2cb39ec 100644 --- a/scribo/ChangeLog +++ b/scribo/ChangeLog @@ -1,5 +1,13 @@ 2010-08-09 Guillaume Lazzara <z@lrde.epita.fr> + Add a new rotation tool. + + * src/preprocessing/Makefile.am: Add a new target. + + * src/preprocessing/rotate.cc: New. + +2010-08-09 Guillaume Lazzara <z@lrde.epita.fr> + Remove deprecated references to object_image. * core/object_image.hh: Remove. diff --git a/scribo/src/preprocessing/Makefile.am b/scribo/src/preprocessing/Makefile.am index 5dabcac..0c6e00a 100644 --- a/scribo/src/preprocessing/Makefile.am +++ b/scribo/src/preprocessing/Makefile.am @@ -41,6 +41,15 @@ if HAVE_MAGICKXX $(MAGICKXX_LDFLAGS) \ -lpthread + bin_PROGRAMS += rotate + rotate_SOURCES = rotate.cc + rotate_CPPFLAGS = $(AM_CPPFLAGS) \ + $(MAGICKXX_CPPFLAGS) + + rotate_LDFLAGS = $(AM_LDFLAGS) \ + $(MAGICKXX_LDFLAGS) \ + -lpthread + bin_PROGRAMS += rotate_90 rotate_90_SOURCES = rotate_90.cc rotate_90_CPPFLAGS = $(AM_CPPFLAGS) \ diff --git a/scribo/src/preprocessing/subsample.cc b/scribo/src/preprocessing/rotate.cc similarity index 80% copy from scribo/src/preprocessing/subsample.cc copy to scribo/src/preprocessing/rotate.cc index fde31e0..2910684 100644 --- a/scribo/src/preprocessing/subsample.cc +++ b/scribo/src/preprocessing/rotate.cc @@ -24,13 +24,13 @@ // executable file might be covered by the GNU General Public License. #include <mln/core/image/image2d.hh> -#include <mln/core/alias/neighb2d.hh> +#include <mln/value/rgb8.hh> #include <mln/io/magick/load.hh> #include <mln/io/ppm/save.hh> -#include <mln/subsampling/antialiased.hh> +#include <mln/geom/rotate.hh> -#include <mln/value/rgb8.hh> +#include <mln/literal/black.hh> #include <scribo/debug/usage.hh> @@ -38,30 +38,31 @@ const char *args_desc[][2] = { { "input.*", "An image." }, - { "ratio", "Scale ratio." }, - { "output.ppm", "A color image." }, + { "output.ppm", "A rotated image." }, + { "angle", "The rotation angle." }, {0, 0} }; + int main(int argc, char *argv[]) { using namespace mln; if (argc != 4) return scribo::debug::usage(argv, - "Subsample.", - "input.* ratio output.ppm", + "Rotation of an image from an arbitrary " + "angle.", + "input.* output.ppm angle", args_desc); - trace::entering("main"); typedef image2d<value::rgb8> I; - I input; - io::magick::load(input, argv[1]); + I ima; + io::magick::load(ima, argv[1]); - unsigned ratio = atoi(argv[2]); - io::ppm::save(mln::subsampling::antialiased(input, ratio), argv[3]); + image2d<value::rgb8> + out = mln::geom::rotate(ima, atof(argv[3]), literal::black); - trace::exiting("main"); + io::ppm::save(out, argv[2]); } -- 1.5.6.5
participants (1)
-
Guillaume Lazzara