From 0c74cc4f4dc739772f7c1f450c96e4b6abd9bd3a Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 26 Jan 2009 11:07:11 +0100 Subject: standardize -t option for stitching to a TIFF file --- NEWS | 6 ++++++ README | 14 ++++++++------ src/Stitch.H | 3 --- src/Stitch.cxx | 41 ++--------------------------------------- src/gipfel.cxx | 19 +++---------------- 5 files changed, 19 insertions(+), 64 deletions(-) diff --git a/NEWS b/NEWS index 395b928..15dbfdd 100644 --- a/NEWS +++ b/NEWS @@ -5,6 +5,12 @@ gipfel-0.2.6 * Improve image saving. It is now possible to overwrite the current image file. * Install README file to $PREFIX/share/doc/gipfel/. +* Change semantics of -t option. + -t now requires a file just as -j does. + To generate multiple TIFF files as input to enblend, just do + for i in *.jpg; do gipfel -s -b -t tiff/$i $i; done + This simplifies the code and allows to parallelize stitching on + multicore systems. gipfel-0.2.5 * Improved stitching speed. diff --git a/README b/README index 8343d78..bb6822e 100644 --- a/README +++ b/README @@ -177,12 +177,14 @@ You can then call to see the result in a window. Alternatively you can call gipfel -s -j ... to save the result as a JPEG image to or - gipfel -s -t ... -to save the result as multiple TIFF images to directory . -Use the multiple TIFF option for blending the result with enblend -. -The width and height of the result images can be adjusted with the --w and -h options. + gipfel -s -t ... +to save the result as TIFF image. +To get multiple TIFF images as input for +, call gipfel like this: + for i in *.jpg; do gipfel -s -b -t tiff/$i $i; done + +The width and height of the result images can be adjusted with +additional -w and -h options. You can use the -b switch to enable bicubic interpolation, which gives smoother results but is a bit slower. diff --git a/src/Stitch.H b/src/Stitch.H index 0632192..1617379 100644 --- a/src/Stitch.H +++ b/src/Stitch.H @@ -18,7 +18,6 @@ class Stitch { private: GipfelWidget *gipf[MAX_PICS]; int num_pics; - OutputImage *single_images[MAX_PICS]; OutputImage *merged_image; public: @@ -30,8 +29,6 @@ class Stitch { OutputImage * set_output(OutputImage *img); - OutputImage * set_output(const char *file, OutputImage *img); - int resample(GipfelWidget::sample_mode_t m, int w, int h, double view_start, double view_end); }; diff --git a/src/Stitch.cxx b/src/Stitch.cxx index 251323d..6ab6542 100644 --- a/src/Stitch.cxx +++ b/src/Stitch.cxx @@ -23,10 +23,8 @@ static double pi_d = asin(1.0) * 2.0; static double deg2rad = pi_d / 180.0; Stitch::Stitch() { - for (int i=0; iget_image_filename(); - if (img_file && strcmp(file, img_file) == 0) { - ret = single_images[i]; - single_images[i] = img; - break; - } - } - } - - return ret; -} - int Stitch::resample(GipfelWidget::sample_mode_t m, int w, int h, double view_start, double view_end) { @@ -102,11 +82,6 @@ Stitch::resample(GipfelWidget::sample_mode_t m, if (merged_image->init(w, h) != 0) merged_image = NULL; - for (int i=0; iinit(w, h) != 0) - single_images[i] = NULL; - for (int y = 0; y < h; y++) { double a_nick = atan((double)(y_off - y)/radius); @@ -115,7 +90,7 @@ Stitch::resample(GipfelWidget::sample_mode_t m, a_view = view_start + x * step_view; merged_pixel_set = 0; for (int i = 0; i < num_pics; i++) { - if (merged_pixel_set && !single_images[i]) + if (merged_pixel_set) continue; if (gipf[i]->get_pixel(m, a_view, a_nick, @@ -125,9 +100,6 @@ Stitch::resample(GipfelWidget::sample_mode_t m, g = std::max(std::min(g, MAX_VALUE), 0); b = std::max(std::min(b, MAX_VALUE), 0); - if (single_images[i]) - single_images[i]->set_pixel(x, r, g, b); - if (!merged_pixel_set && merged_image) { merged_image->set_pixel(x, r, g, b); merged_pixel_set++; @@ -138,19 +110,10 @@ Stitch::resample(GipfelWidget::sample_mode_t m, if (merged_image) merged_image->next_line(); - - for (int i=0; inext_line(); - } } if (merged_image) merged_image->done(); - for (int i=0; idone(); - return 0; } diff --git a/src/gipfel.cxx b/src/gipfel.cxx index ce90816..69648d6 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -293,8 +293,8 @@ void usage() { " -b Use bicubic interpolation for stitching.\n" " -w Width of result image.\n" " -h Height of result image.\n" - " -j JPEG output file for Stitch mode.\n" - " -t Output directory for TIFF images in Stitch mode.\n" + " -j JPEG output file in Stitch mode.\n" + " -t TIFF output file in Stitch mode.\n" " -p Export position of image to stdout.\n" " -e Export positions of hills from on image.\n" " -E Export hills from default data file.\n" @@ -623,20 +623,7 @@ stitch(GipfelWidget::sample_mode_t m, int b_16, } else if (type & STITCH_TIFF) { - for (int i=0; iset_output(argv[i], new TIFFOutputImage(buf, b_16?16:8)); - } - + st->set_output(new TIFFOutputImage(path, 90)); st->resample(m, stitch_w, stitch_h, from, to); } else { -- cgit v1.2.3