summaryrefslogtreecommitdiff
path: root/src
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 /src
parent3316ced96912c0112f39cafa851a538b0f3c75e9 (diff)
standardize -t option for stitching to a TIFF file
Diffstat (limited to 'src')
-rw-r--r--src/Stitch.H3
-rw-r--r--src/Stitch.cxx41
-rw-r--r--src/gipfel.cxx19
3 files changed, 5 insertions, 58 deletions
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 {