summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-01-26 11:07:11 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-01-26 11:07:11 +0100
commit0c74cc4f4dc739772f7c1f450c96e4b6abd9bd3a (patch)
tree057193342653857e5cb88e011a185ecc9cee3c28
parent3316ced96912c0112f39cafa851a538b0f3c75e9 (diff)
standardize -t option for stitching to a TIFF file
-rw-r--r--NEWS6
-rw-r--r--README14
-rw-r--r--src/Stitch.H3
-rw-r--r--src/Stitch.cxx41
-rw-r--r--src/gipfel.cxx19
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 <outimg> <img1> <img2> ...
to save the result as a JPEG image to <outimg> or
- gipfel -s -t <outdir> <img1> <img2> ...
-to save the result as multiple TIFF images to directory <outdir>.
-Use the multiple TIFF option for blending the result with enblend
-<http://enblend.sourceforge.net/>.
-The width and height of the result images can be adjusted with the
--w and -h options.
+ gipfel -s -t <outimg> <img1> <img2> ...
+to save the result as TIFF image.
+To get multiple TIFF images as input for
+<http://enblend.sourceforge.net/>, 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; i<MAX_PICS; i++) {
+ for (int i=0; i<MAX_PICS; i++)
gipf[i] = NULL;
- single_images[i] = NULL;
- }
merged_image = NULL;
num_pics = 0;
@@ -67,24 +65,6 @@ Stitch::set_output(OutputImage *img) {
return ret;
}
-OutputImage*
-Stitch::set_output(const char *file, OutputImage *img) {
- OutputImage *ret = NULL;
-
- for (int i=0; i<MAX_PICS; i++) {
- if (gipf[i] != NULL) {
- const char *img_file = gipf[i]->get_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; i<MAX_PICS; i++)
- if (single_images[i])
- if (single_images[i]->init(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; i<MAX_PICS; i++) {
- if (single_images[i])
- single_images[i]->next_line();
- }
}
if (merged_image)
merged_image->done();
- for (int i=0; i<MAX_PICS; i++)
- if (single_images[i])
- single_images[i]->done();
-
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> Width of result image.\n"
" -h <height> Height of result image.\n"
- " -j <file> JPEG output file for Stitch mode.\n"
- " -t <dir> Output directory for TIFF images in Stitch mode.\n"
+ " -j <file> JPEG output file in Stitch mode.\n"
+ " -t <file> TIFF output file in Stitch mode.\n"
" -p Export position of image to stdout.\n"
" -e <file> Export positions of hills from <file> 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; i<argc; i++) {
- char buf[1024];
- char *dot;
-
- snprintf(buf, sizeof(buf), "%s/%s", path, basename(argv[i]));
- dot = strrchr(buf, '.');
- if (dot)
- *dot = '\0';
-
- strncat(buf, ".tiff", sizeof(buf));
-
- st->set_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 {