From c00e603b4bfe336683c713cca80cbba47e639678 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 7 Mar 2007 22:25:03 +0100 Subject: add GUI stuff for x0 --- src/gipfel.cxx | 51 ++++++++++++++++++++++++++++++++++----------------- 1 file changed, 34 insertions(+), 17 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index bb58586..5807ae5 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -46,7 +46,7 @@ Fl_Window *control_win, *view_win; Fl_Dial *s_center = NULL; Fl_Slider *s_nick, *s_focal_length, *s_tilt, *s_height_dist, *s_track_width; Fl_Value_Input *i_view_lat, *i_view_long, *i_view_height; -Fl_Value_Input *i_distortion_k0, *i_distortion_k1; +Fl_Value_Input *i_distortion_k0, *i_distortion_k1, *i_distortion_x0; Fl_Box *b_viewpoint; Fl_Menu_Bar *mb; @@ -58,7 +58,7 @@ static int stitch(GipfelWidget::sample_mode_t m ,int stitch_w, int stitch_h, double from, double to, int type, const char *path, int argc, char **argv); void set_values() { - double k0 = 0.0, k1 = 0.0; + double k0 = 0.0, k1 = 0.0, x0 = 0.0; s_center->value(gipf->get_center_angle()); s_nick->value(gipf->get_nick_angle()); @@ -77,9 +77,10 @@ void set_values() { mb->mode(8, FL_MENU_RADIO); } - gipf->get_distortion_params(&k0, &k1); + gipf->get_distortion_params(&k0, &k1, &x0); i_distortion_k0->value(k0); i_distortion_k1->value(k1); + i_distortion_x0->value(x0); } void quit_cb() { @@ -174,12 +175,12 @@ void comp_cb(Fl_Widget *, void *) { void save_distortion_cb(Fl_Widget *, void *) { char buf[1024]; const char * prof_name; - double k0, k1; + double k0, k1, x0; - gipf->get_distortion_params(&k0, &k1); + gipf->get_distortion_params(&k0, &k1, &x0); gipf->get_distortion_profile_name(buf, sizeof(buf)); - prof_name = fl_input("Save Distortion Profile (k0=%f, k1=%f)", - buf, k0, k1); + prof_name = fl_input("Save Distortion Profile (k0=%f, k1=%f, x0=%f)", + buf, k0, k1, x0); if (prof_name == NULL) { return; @@ -208,8 +209,10 @@ void load_distortion_cb(Fl_Widget *, void *) { } void distortion_cb(Fl_Value_Input*, void*) { - gipf->set_distortion_params(i_distortion_k0->value(), - i_distortion_k1->value()); + gipf->set_distortion_params( + i_distortion_k0->value(), + i_distortion_k1->value(), + i_distortion_x0->value()); } void about_cb() { @@ -355,23 +358,31 @@ create_control_window() { i_view_height->when(FL_WHEN_ENTER_KEY); i_view_height->callback((Fl_Callback*)view_height_cb); - i_distortion_k0 = new Fl_Value_Input(235, 220, 80, 20, "Distortion (k0)"); + i_distortion_k0 = new Fl_Value_Input(250, 200, 80, 20, "k0"); i_distortion_k0->labelsize(10); i_distortion_k0->textsize(10); - i_distortion_k0->align(FL_ALIGN_TOP); + i_distortion_k0->align(FL_ALIGN_LEFT); i_distortion_k0->when(FL_WHEN_ENTER_KEY); i_distortion_k0->callback((Fl_Callback*)distortion_cb); - i_distortion_k1 = new Fl_Value_Input(315, 220, 80, 20, "Distortion (k1)"); + i_distortion_k1 = new Fl_Value_Input(250, 225, 80, 20, "k1"); i_distortion_k1->labelsize(10); i_distortion_k1->textsize(10); - i_distortion_k1->align(FL_ALIGN_TOP); + i_distortion_k1->align(FL_ALIGN_LEFT); i_distortion_k1->when(FL_WHEN_ENTER_KEY); i_distortion_k1->callback((Fl_Callback*)distortion_cb); + i_distortion_x0 = new Fl_Value_Input(250, 250, 80, 20, "x0"); + i_distortion_x0->labelsize(10); + i_distortion_x0->textsize(10); + i_distortion_x0->align(FL_ALIGN_LEFT); + i_distortion_x0->when(FL_WHEN_ENTER_KEY); + i_distortion_x0->callback((Fl_Callback*)distortion_cb); + + // Buttons - Fl_Button *b = new Fl_Button(260, 260, 100, 20, "comp"); + Fl_Button *b = new Fl_Button(280, 280, 100, 20, "comp"); b->color(FL_RED); b->tooltip("compute view parameter from given mountains"); b->callback(comp_cb); @@ -388,7 +399,7 @@ int main(int argc, char** argv) { int jpeg_flag = 0, tiff_flag = 0, distortion_flag = 0; int bilinear_flag = 0; double stitch_from = 0.0, stitch_to = 380.0; - double dist_k0 = 0.0, dist_k1 = 0.0; + double dist_k0 = 0.0, dist_k1 = 0.0, dist_x0 = 0.0; char *outpath = "/tmp"; Fl_Scroll *scroll; @@ -419,11 +430,17 @@ int main(int argc, char** argv) { } break; case 'u': + char *c; distortion_flag++; if (optarg && strcmp(optarg, ":")) { dist_k0 = atof(optarg); - if (strchr(optarg, ',')) { + c = strchr(optarg, ','); + if (c) { dist_k1 = atof(strchr(optarg, ',') + 1); + c = strchr(c + 1, ','); + if (c) { + dist_x0 = atof(strchr(optarg, ',') + 1); + } } } break; @@ -501,7 +518,7 @@ int main(int argc, char** argv) { } if (distortion_flag) { - gipf->set_distortion_params(dist_k0, dist_k1); + gipf->set_distortion_params(dist_k0, dist_k1, dist_x0); } view_win->size(gipf->w(), gipf->h()); -- cgit v1.2.3 From 3d907fd76ca23d69bcd7d25367c9c94063490d38 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 13 Mar 2007 18:29:45 +0100 Subject: add devignetting infrastructure --- src/gipfel.cxx | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 5807ae5..3862761 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -50,9 +50,10 @@ Fl_Value_Input *i_distortion_k0, *i_distortion_k1, *i_distortion_x0; Fl_Box *b_viewpoint; Fl_Menu_Bar *mb; -#define STITCH_PREVIEW 1 -#define STITCH_JPEG 2 -#define STITCH_TIFF 4 +#define STITCH_PREVIEW 1 +#define STITCH_JPEG 2 +#define STITCH_TIFF 4 +#define STITCH_VIGNETTE_CALIB 8 static int stitch(GipfelWidget::sample_mode_t m ,int stitch_w, int stitch_h, double from, double to, int type, const char *path, int argc, char **argv); @@ -397,7 +398,7 @@ int main(int argc, char** argv) { int err, my_argc; int stitch_flag = 0, stitch_w = 2000, stitch_h = 500; int jpeg_flag = 0, tiff_flag = 0, distortion_flag = 0; - int bilinear_flag = 0; + int bilinear_flag = 0, vignette_flag = 0; double stitch_from = 0.0, stitch_to = 380.0; double dist_k0 = 0.0, dist_k1 = 0.0, dist_x0 = 0.0; char *outpath = "/tmp"; @@ -405,7 +406,7 @@ int main(int argc, char** argv) { err = 0; - while ((c = getopt(argc, argv, ":?d:v:sw:h:j:t:u:br:")) != EOF) { + while ((c = getopt(argc, argv, ":?d:v:sw:h:j:t:u:br:V")) != EOF) { switch (c) { case '?': usage(); @@ -420,6 +421,9 @@ int main(int argc, char** argv) { case 's': stitch_flag++; break; + case 'V': + vignette_flag++; + break; case 'r': stitch_flag++; if (optarg && strcmp(optarg, ":")) { @@ -485,6 +489,8 @@ int main(int argc, char** argv) { type = STITCH_JPEG; } else if (tiff_flag) { type = STITCH_TIFF; + } else if (vignette_flag) { + type = STITCH_VIGNETTE_CALIB; } stitch(bilinear_flag?GipfelWidget::BILINEAR:GipfelWidget::NEAREST, @@ -579,6 +585,10 @@ stitch(GipfelWidget::sample_mode_t m, st->resample(m, stitch_w, stitch_h, from, to); + } else if (type = STITCH_VIGNETTE_CALIB) { + + st->vignette_calib(m, stitch_w, stitch_h, from, to); + } else { win = new Fl_Window(0,0, stitch_w, stitch_h); scroll = new Fl_Scroll(0, 0, win->w(), win->h()); -- cgit v1.2.3 From d47080e941184c48e76f535111a4657639d1a428 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 13 Mar 2007 20:12:51 +0100 Subject: gsl based version --- src/gipfel.cxx | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 3862761..584ae15 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -585,10 +585,6 @@ stitch(GipfelWidget::sample_mode_t m, st->resample(m, stitch_w, stitch_h, from, to); - } else if (type = STITCH_VIGNETTE_CALIB) { - - st->vignette_calib(m, stitch_w, stitch_h, from, to); - } else { win = new Fl_Window(0,0, stitch_w, stitch_h); scroll = new Fl_Scroll(0, 0, win->w(), win->h()); @@ -598,7 +594,13 @@ stitch(GipfelWidget::sample_mode_t m, win->resizable(scroll); win->show(0, argv); st->set_output((OutputImage*) img); - st->resample(m, stitch_w, stitch_h, from, to); + + if (type == STITCH_VIGNETTE_CALIB) { + st->vignette_calib(m, stitch_w, stitch_h, from, to); + } else { + st->resample(m, stitch_w, stitch_h, from, to); + } + img->redraw(); Fl::run(); } -- cgit v1.2.3 From 905cd5600e604aa1f9fe256ab3b4d7125695951e Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 15 Mar 2007 00:25:29 +0100 Subject: add color and brightness adjustment --- src/gipfel.cxx | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 584ae15..7aad38f 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -596,7 +596,9 @@ stitch(GipfelWidget::sample_mode_t m, st->set_output((OutputImage*) img); if (type == STITCH_VIGNETTE_CALIB) { - st->vignette_calib(m, stitch_w, stitch_h, from, to); + st->color_calib(m, stitch_w, stitch_h, from, to); + //st->vignette_calib(m, stitch_w, stitch_h, from, to); + st->resample(m, stitch_w, stitch_h, from, to); } else { st->resample(m, stitch_w, stitch_h, from, to); } -- cgit v1.2.3 From c7a40505652adc10d29b2049bb4553cf91cec823 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 15 Mar 2007 15:58:00 +0100 Subject: make it work with fixed vignetting params --- src/gipfel.cxx | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 7aad38f..23a5c5f 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -484,13 +484,17 @@ int main(int argc, char** argv) { } if (stitch_flag) { - int type = STITCH_PREVIEW; + int type = 0; if (jpeg_flag) { type = STITCH_JPEG; } else if (tiff_flag) { type = STITCH_TIFF; - } else if (vignette_flag) { - type = STITCH_VIGNETTE_CALIB; + } else { + type = STITCH_PREVIEW; + } + + if (vignette_flag) { + type |= STITCH_VIGNETTE_CALIB; } stitch(bilinear_flag?GipfelWidget::BILINEAR:GipfelWidget::NEAREST, @@ -564,12 +568,17 @@ stitch(GipfelWidget::sample_mode_t m, st->load_image(argv[i]); } - if (type == STITCH_JPEG) { + if (type & STITCH_VIGNETTE_CALIB) { + st->color_calib(m, stitch_w, stitch_h, from, to); + //st->vignette_calib(m, stitch_w, stitch_h, from, to); + } + + if (type & STITCH_JPEG) { st->set_output((OutputImage*) new JPEGOutputImage(path, 90)); st->resample(m, stitch_w, stitch_h, from, to); - } else if (type == STITCH_TIFF) { + } else if (type & STITCH_TIFF) { for (int i=0; ishow(0, argv); st->set_output((OutputImage*) img); - if (type == STITCH_VIGNETTE_CALIB) { - st->color_calib(m, stitch_w, stitch_h, from, to); - //st->vignette_calib(m, stitch_w, stitch_h, from, to); - st->resample(m, stitch_w, stitch_h, from, to); - } else { - st->resample(m, stitch_w, stitch_h, from, to); - } + st->resample(m, stitch_w, stitch_h, from, to); img->redraw(); Fl::run(); -- cgit v1.2.3 From 5fd1230803fddcfb8e3cfb38608221ef52c0f104 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 16 Mar 2007 15:20:43 +0100 Subject: try linear version - does not work yet --- src/gipfel.cxx | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 23a5c5f..e9743d8 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -568,10 +568,6 @@ stitch(GipfelWidget::sample_mode_t m, st->load_image(argv[i]); } - if (type & STITCH_VIGNETTE_CALIB) { - st->color_calib(m, stitch_w, stitch_h, from, to); - //st->vignette_calib(m, stitch_w, stitch_h, from, to); - } if (type & STITCH_JPEG) { @@ -604,6 +600,9 @@ stitch(GipfelWidget::sample_mode_t m, win->show(0, argv); st->set_output((OutputImage*) img); + if (type & STITCH_VIGNETTE_CALIB) { + st->vignette_calib(m, stitch_w, stitch_h, from, to); + } st->resample(m, stitch_w, stitch_h, from, to); img->redraw(); -- cgit v1.2.3 From 759799defe3e388bc9ec7255c79895138194e4fa Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sat, 17 Mar 2007 21:47:58 +0100 Subject: show sample points in separate window --- src/gipfel.cxx | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index e9743d8..410471d 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -569,6 +569,17 @@ stitch(GipfelWidget::sample_mode_t m, } + if (type & STITCH_VIGNETTE_CALIB) { + win = new Fl_Window(0,0, 1000, 400); + scroll = new Fl_Scroll(0, 0, win->w(), win->h()); + PreviewOutputImage *img = + new PreviewOutputImage(0, 0, 1000, 400); + + win->resizable(scroll); + win->show(0, argv); + st->set_output((OutputImage*) img); + st->vignette_calib(m, stitch_w, stitch_h, from, to); + } if (type & STITCH_JPEG) { st->set_output((OutputImage*) new JPEGOutputImage(path, 90)); @@ -600,9 +611,6 @@ stitch(GipfelWidget::sample_mode_t m, win->show(0, argv); st->set_output((OutputImage*) img); - if (type & STITCH_VIGNETTE_CALIB) { - st->vignette_calib(m, stitch_w, stitch_h, from, to); - } st->resample(m, stitch_w, stitch_h, from, to); img->redraw(); -- cgit v1.2.3 From 5432343cc8bd34a77a1584be33abbd53cdd6e373 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 18 Mar 2007 12:22:50 +0100 Subject: implement bicubic interpolation --- src/gipfel.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 410471d..8620641 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -497,7 +497,7 @@ int main(int argc, char** argv) { type |= STITCH_VIGNETTE_CALIB; } - stitch(bilinear_flag?GipfelWidget::BILINEAR:GipfelWidget::NEAREST, + stitch(bilinear_flag?GipfelWidget::BICUBIC:GipfelWidget::NEAREST, stitch_w, stitch_h, stitch_from, stitch_to, type, outpath, my_argc, my_argv); -- cgit v1.2.3 From 16be964c674ef4735e9ed925b78ac06a262c389d Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 18 Mar 2007 14:20:57 +0100 Subject: bilinear->bicubic --- src/gipfel.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 8620641..8ef6b22 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -398,7 +398,7 @@ int main(int argc, char** argv) { int err, my_argc; int stitch_flag = 0, stitch_w = 2000, stitch_h = 500; int jpeg_flag = 0, tiff_flag = 0, distortion_flag = 0; - int bilinear_flag = 0, vignette_flag = 0; + int bicubic_flag = 0, vignette_flag = 0; double stitch_from = 0.0, stitch_to = 380.0; double dist_k0 = 0.0, dist_k1 = 0.0, dist_x0 = 0.0; char *outpath = "/tmp"; @@ -463,7 +463,7 @@ int main(int argc, char** argv) { stitch_h = atoi(optarg); break; case 'b': - bilinear_flag++; + bicubic_flag++; break; default: err++; @@ -497,7 +497,7 @@ int main(int argc, char** argv) { type |= STITCH_VIGNETTE_CALIB; } - stitch(bilinear_flag?GipfelWidget::BICUBIC:GipfelWidget::NEAREST, + stitch(bicubic_flag?GipfelWidget::BICUBIC:GipfelWidget::NEAREST, stitch_w, stitch_h, stitch_from, stitch_to, type, outpath, my_argc, my_argv); -- cgit v1.2.3 From eb4b8da95067a71e727571a5da2bede913690dd0 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 19 Mar 2007 18:52:45 +0100 Subject: implement color correction --- src/gipfel.cxx | 1 + 1 file changed, 1 insertion(+) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 8ef6b22..9653ae1 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -579,6 +579,7 @@ stitch(GipfelWidget::sample_mode_t m, win->show(0, argv); st->set_output((OutputImage*) img); st->vignette_calib(m, stitch_w, stitch_h, from, to); + // st->color_calib(m, stitch_w, stitch_h, from, to); } if (type & STITCH_JPEG) { -- cgit v1.2.3 From 5da6f96ece0ecf24c8eade8378ca4c90846a8265 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 19 Mar 2007 19:53:50 +0100 Subject: cleanups --- src/gipfel.cxx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 9653ae1..db13287 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -579,7 +579,7 @@ stitch(GipfelWidget::sample_mode_t m, win->show(0, argv); st->set_output((OutputImage*) img); st->vignette_calib(m, stitch_w, stitch_h, from, to); - // st->color_calib(m, stitch_w, stitch_h, from, to); + //st->color_calib(m, stitch_w, stitch_h, from, to); } if (type & STITCH_JPEG) { -- cgit v1.2.3 From 5b4a674c5922c6516ce6fe580800bacb5bf18b91 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 9 May 2007 18:49:32 +0200 Subject: remove color- and vignetting correction code --- src/gipfel.cxx | 24 ++---------------------- 1 file changed, 2 insertions(+), 22 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index db13287..9db0fce 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -53,7 +53,6 @@ Fl_Menu_Bar *mb; #define STITCH_PREVIEW 1 #define STITCH_JPEG 2 #define STITCH_TIFF 4 -#define STITCH_VIGNETTE_CALIB 8 static int stitch(GipfelWidget::sample_mode_t m ,int stitch_w, int stitch_h, double from, double to, int type, const char *path, int argc, char **argv); @@ -398,7 +397,7 @@ int main(int argc, char** argv) { int err, my_argc; int stitch_flag = 0, stitch_w = 2000, stitch_h = 500; int jpeg_flag = 0, tiff_flag = 0, distortion_flag = 0; - int bicubic_flag = 0, vignette_flag = 0; + int bicubic_flag = 0; double stitch_from = 0.0, stitch_to = 380.0; double dist_k0 = 0.0, dist_k1 = 0.0, dist_x0 = 0.0; char *outpath = "/tmp"; @@ -406,7 +405,7 @@ int main(int argc, char** argv) { err = 0; - while ((c = getopt(argc, argv, ":?d:v:sw:h:j:t:u:br:V")) != EOF) { + while ((c = getopt(argc, argv, ":?d:v:sw:h:j:t:u:br:")) != EOF) { switch (c) { case '?': usage(); @@ -421,9 +420,6 @@ int main(int argc, char** argv) { case 's': stitch_flag++; break; - case 'V': - vignette_flag++; - break; case 'r': stitch_flag++; if (optarg && strcmp(optarg, ":")) { @@ -493,10 +489,6 @@ int main(int argc, char** argv) { type = STITCH_PREVIEW; } - if (vignette_flag) { - type |= STITCH_VIGNETTE_CALIB; - } - stitch(bicubic_flag?GipfelWidget::BICUBIC:GipfelWidget::NEAREST, stitch_w, stitch_h, stitch_from, stitch_to, type, outpath, my_argc, my_argv); @@ -569,18 +561,6 @@ stitch(GipfelWidget::sample_mode_t m, } - if (type & STITCH_VIGNETTE_CALIB) { - win = new Fl_Window(0,0, 1000, 400); - scroll = new Fl_Scroll(0, 0, win->w(), win->h()); - PreviewOutputImage *img = - new PreviewOutputImage(0, 0, 1000, 400); - - win->resizable(scroll); - win->show(0, argv); - st->set_output((OutputImage*) img); - st->vignette_calib(m, stitch_w, stitch_h, from, to); - //st->color_calib(m, stitch_w, stitch_h, from, to); - } if (type & STITCH_JPEG) { st->set_output((OutputImage*) new JPEGOutputImage(path, 90)); -- cgit v1.2.3 From a7784b543b1bf2052b301457b5b7d4f64d20595e Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 18 May 2007 19:17:59 +0200 Subject: add 16bit output support --- src/gipfel.cxx | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) (limited to 'src/gipfel.cxx') diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 9db0fce..3fbf945 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -54,7 +54,8 @@ Fl_Menu_Bar *mb; #define STITCH_JPEG 2 #define STITCH_TIFF 4 -static int stitch(GipfelWidget::sample_mode_t m ,int stitch_w, int stitch_h, +static int stitch(GipfelWidget::sample_mode_t m , int b_16, + int stitch_w, int stitch_h, double from, double to, int type, const char *path, int argc, char **argv); void set_values() { @@ -256,6 +257,7 @@ void usage() { " -d Use for GPS data.\n" " -u , Use distortion correction values k0,k1.\n" " -s Stitch mode.\n" + " -4 Create 16bit output (only with TIFF stitching).\n" " -r , Stitch range in degrees (e.g. 100.0,200.0).\n" " -b Use bilinear interpolation for stitching.\n" " -w Width of result image.\n" @@ -397,7 +399,7 @@ int main(int argc, char** argv) { int err, my_argc; int stitch_flag = 0, stitch_w = 2000, stitch_h = 500; int jpeg_flag = 0, tiff_flag = 0, distortion_flag = 0; - int bicubic_flag = 0; + int bicubic_flag = 0, b_16_flag = 0; double stitch_from = 0.0, stitch_to = 380.0; double dist_k0 = 0.0, dist_k1 = 0.0, dist_x0 = 0.0; char *outpath = "/tmp"; @@ -405,7 +407,7 @@ int main(int argc, char** argv) { err = 0; - while ((c = getopt(argc, argv, ":?d:v:sw:h:j:t:u:br:")) != EOF) { + while ((c = getopt(argc, argv, ":?d:v:sw:h:j:t:u:br:4")) != EOF) { switch (c) { case '?': usage(); @@ -420,6 +422,9 @@ int main(int argc, char** argv) { case 's': stitch_flag++; break; + case '4': + b_16_flag++; + break; case 'r': stitch_flag++; if (optarg && strcmp(optarg, ":")) { @@ -490,6 +495,7 @@ int main(int argc, char** argv) { } stitch(bicubic_flag?GipfelWidget::BICUBIC:GipfelWidget::NEAREST, + b_16_flag, stitch_w, stitch_h, stitch_from, stitch_to, type, outpath, my_argc, my_argv); @@ -548,7 +554,7 @@ int main(int argc, char** argv) { } static int -stitch(GipfelWidget::sample_mode_t m, +stitch(GipfelWidget::sample_mode_t m, int b_16, int stitch_w, int stitch_h, double from, double to, int type, const char *path, int argc, char **argv) { @@ -563,7 +569,7 @@ stitch(GipfelWidget::sample_mode_t m, if (type & STITCH_JPEG) { - st->set_output((OutputImage*) new JPEGOutputImage(path, 90)); + st->set_output(new JPEGOutputImage(path, 90)); st->resample(m, stitch_w, stitch_h, from, to); } else if (type & STITCH_TIFF) { @@ -577,7 +583,7 @@ stitch(GipfelWidget::sample_mode_t m, *dot = '\0'; strncat(buf, ".tiff", sizeof(buf)); - st->set_output(argv[i], (OutputImage*) new TIFFOutputImage(buf)); + st->set_output(argv[i], new TIFFOutputImage(buf, b_16?16:8)); } st->resample(m, stitch_w, stitch_h, from, to); @@ -590,7 +596,7 @@ stitch(GipfelWidget::sample_mode_t m, win->resizable(scroll); win->show(0, argv); - st->set_output((OutputImage*) img); + st->set_output(img); st->resample(m, stitch_w, stitch_h, from, to); -- cgit v1.2.3