diff options
-rw-r--r-- | src/GipfelWidget.H | 2 | ||||
-rw-r--r-- | src/GipfelWidget.cxx | 6 | ||||
-rw-r--r-- | src/Panorama.H | 2 | ||||
-rw-r--r-- | src/Panorama.cxx | 7 | ||||
-rw-r--r-- | src/ProjectionTangentialLSQ.cxx | 28 | ||||
-rw-r--r-- | src/gipfel.cxx | 13 |
6 files changed, 31 insertions, 27 deletions
diff --git a/src/GipfelWidget.H b/src/GipfelWidget.H index cba4513..0389896 100644 --- a/src/GipfelWidget.H +++ b/src/GipfelWidget.H @@ -108,6 +108,8 @@ class GipfelWidget : public Fl_Widget { void set_projection(Projection::Projection_t p); + void set_distortion_params(double k0, double k1); + Hills *get_mountains(); int comp_params(); diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index e1dad77..0d92095 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -472,6 +472,12 @@ GipfelWidget::set_projection(Projection::Projection_t p) { redraw(); } +void +GipfelWidget::set_distortion_params(double k0, double k1) { + pan->set_distortion_params(k0, k1); + redraw(); +} + Projection::Projection_t GipfelWidget::get_projection() { return pan->get_projection(); diff --git a/src/Panorama.H b/src/Panorama.H index bfb39b8..4db046e 100644 --- a/src/Panorama.H +++ b/src/Panorama.H @@ -131,6 +131,8 @@ class Panorama { void set_projection(Projection::Projection_t p); + void set_distortion_params(double k0, double k1); + int get_coordinates(double a_view, double a_nick, double *x, double *y); }; #endif diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 503f373..8b21fda 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -257,6 +257,13 @@ Panorama::set_scale(double s) { } void +Panorama::set_distortion_params(double k0, double k1) { + parms.k0 = k0; + parms.k1 = k1; + update_coordinates(); +} + +void Panorama::set_height_dist_ratio(double r) { height_dist_ratio = r; update_close_mountains(); diff --git a/src/ProjectionTangentialLSQ.cxx b/src/ProjectionTangentialLSQ.cxx index 9bbf81c..73a4bad 100644 --- a/src/ProjectionTangentialLSQ.cxx +++ b/src/ProjectionTangentialLSQ.cxx @@ -37,7 +37,7 @@ ProjectionTangentialLSQ::comp_params(const Hills *h, ViewParams *parms) { double a_center_tmp, scale_tmp, a_nick_tmp; if (h->get_num() < 2) { - fprintf(stderr, "Please position at least 3 hills\n"); + fprintf(stderr, "Please position at least 2 hills\n"); return 1; } else if (h->get_num() > 3) { fprintf(stderr, "Performing calibration\n"); @@ -244,31 +244,7 @@ ProjectionTangentialLSQ::lsq(const Hills *h, ViewParams *parms) { gsl_multifit_fdfsolver_free (s); - double t_x, t_y; - get_coordinates(h->get(0)->a_view, h->get(0)->a_nick, parms, &t_x, &t_y); - fprintf(stderr, "center %f, view %f, nick %f, x %f (%f), dx %f, y %f (%f), dy %f\n", - parms->a_center / deg2rad, - h->get(0)->a_view, h->get(0)->a_nick, - h->get(0)->x, - t_x, - h->get(0)->x - mac_x(parms->a_center, - parms->a_nick, - parms->a_tilt, - parms->scale, - parms->k0, - parms->k1, - h->get(0)->a_view, h->get(0)->a_nick), - h->get(0)->y, - t_y, - h->get(0)->y - mac_y(parms->a_center, - parms->a_nick, - parms->a_tilt, - parms->scale, - parms->k0, - parms->k1, - h->get(0)->a_view, h->get(0)->a_nick)); - - + fprintf(stderr, "k0 %f, k1 %f\n", parms->k0, parms->k1); return 0; } diff --git a/src/gipfel.cxx b/src/gipfel.cxx index a746a2e..3f6bb08 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -204,6 +204,7 @@ void usage() { " This must be a string that unambiguously \n" " matches the name of an entry in the data file.\n" " -d <datafile> Use <datafile> for GPS data.\n" + " -u <k0>,<k1> Use distortion correction values k0,k1.\n" " -s Stitch mode.\n" " -w <width> Width of result image.\n" " -h <height> Height of result image.\n" @@ -325,12 +326,13 @@ int main(int argc, char** argv) { int stitch_flag = 0, stitch_w = 2000, stitch_h = 500; int jpeg_flag = 0, tiff_flag = 0; double stitch_from = 0.0, stitch_to = 380.0; + double dist_k0 = 0.0, dist_k1 = 0.0; char *outpath; Fl_Scroll *scroll; err = 0; - while ((c = getopt(argc, argv, ":?d:v:s:w:h:j:t:")) != EOF) { + while ((c = getopt(argc, argv, ":?d:v:s:w:h:j:t:u:")) != EOF) { switch (c) { case '?': usage(); @@ -351,6 +353,14 @@ int main(int argc, char** argv) { } } break; + case 'u': + if (optarg && strcmp(optarg, ":")) { + dist_k0 = atof(optarg); + if (strchr(optarg, ',')) { + dist_k1 = atof(strchr(optarg, ',') + 1); + } + } + break; case 'j': jpeg_flag++; outpath = optarg; @@ -419,6 +429,7 @@ int main(int argc, char** argv) { control_win->label(img_file); } + gipf->set_distortion_params(dist_k0, dist_k1); view_win->size(gipf->w(), gipf->h()); scroll->size(gipf->w(), gipf->h()); |