summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-03-18 12:28:35 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2007-03-18 12:28:35 +0100
commit3b1c107918825178fc60e54cb818d9098a000293 (patch)
tree1792bfc3b821049b6286dff6f1cb58fb42fb96c8
parent5432343cc8bd34a77a1584be33abbd53cdd6e373 (diff)
parentad1abce7a41bdb5f6d2005ac63f6e8b5599ec244 (diff)
merge with vignette-only
-rw-r--r--src/Stitch.H1
-rw-r--r--src/Stitch.cxx44
2 files changed, 8 insertions, 37 deletions
diff --git a/src/Stitch.H b/src/Stitch.H
index b5fb6fd..7a47cf6 100644
--- a/src/Stitch.H
+++ b/src/Stitch.H
@@ -18,7 +18,6 @@ class Stitch {
private:
GipfelWidget *gipf[MAX_PICS];
int num_pics;
- double color_adjust[MAX_PICS][3];
double V1, V2;
OutputImage *single_images[MAX_PICS];
OutputImage *merged_image;
diff --git a/src/Stitch.cxx b/src/Stitch.cxx
index 2ed72fe..c0a770b 100644
--- a/src/Stitch.cxx
+++ b/src/Stitch.cxx
@@ -109,7 +109,7 @@ Stitch::vignette_calib(GipfelWidget::sample_mode_t m,
int max_samples = 20000 * 3, n_samples = 0;
int ret;
- int n_vars = 2 + num_pics * 3 ;
+ int n_vars = 2 ;
gsl_matrix *X, *cov;
gsl_vector *yv, *c, *wv;
double chisq;
@@ -179,27 +179,12 @@ Stitch::vignette_calib(GipfelWidget::sample_mode_t m,
for (int l = 0; l<3; l++) {
gsl_vector_set(wv, n_samples, 1.0);
- if (p1 == 0) {
- // no color correction for first image
- gsl_matrix_set(X, n_samples, 0, c1d[l] * a1 * a1);
- gsl_matrix_set(X, n_samples, 1, c1d[l] * a1 *a1 * a1 * a1);
- gsl_vector_set(yv, n_samples, -c1d[l]);
- } else {
- gsl_matrix_set(X, n_samples, 0, c1d[l] * a1 * a1);
- gsl_matrix_set(X, n_samples, 1, c1d[l] * a1 *a1 * a1 * a1);
- gsl_matrix_set(X, n_samples, var_offset(p1, l), c1d[l]);
- gsl_vector_set(yv, n_samples, 0.0);
- }
- if (p2 == 0) {
- // no color correction for first image
- gsl_matrix_set(X, n_samples, 0, -c2d[l] * a2 * a2);
- gsl_matrix_set(X, n_samples, 1, -c2d[l] * a2 *a2 * a2 * a2);
- gsl_vector_set(yv, n_samples, c2d[l]);
- } else {
- gsl_matrix_set(X, n_samples, 0, - c2d[l] * a2 * a2);
- gsl_matrix_set(X, n_samples, 1, - c2d[l] * a2 * a2 * a2 * a2);
- gsl_matrix_set(X, n_samples, var_offset(p2, l), - c2d[l]);
- }
+ gsl_matrix_set(X, n_samples, 0, c1d[l] * a1 * a1);
+ gsl_matrix_set(X, n_samples, 1, c1d[l] * a1 *a1 * a1 * a1);
+ gsl_matrix_set(X, n_samples, 0, -c2d[l] * a2 * a2);
+ gsl_matrix_set(X, n_samples, 1, -c2d[l] * a2 *a2 * a2 * a2);
+
+ gsl_vector_set(yv, n_samples, c2d[l]-c1d[l]);
n_samples++;
}
@@ -235,19 +220,6 @@ Stitch::vignette_calib(GipfelWidget::sample_mode_t m,
ret = gsl_multifit_wlinear (X, wv, yv, c, cov, &chisq, work);
gsl_multifit_linear_free (work);
- fprintf(stderr, "gsl_multifit_linear returned %d\n", ret);
-
- for (int p1=0; p1 < num_pics; p1++) {
- for (int l = 0; l<3; l++) {
- if (p1 == 0) {
- color_adjust[p1][l] = 1.0;
- } else {
- color_adjust[p1][l] = gsl_vector_get(c, var_offset(p1, l));
- }
- }
-fprintf(stderr, "==> color_adjust(%d) %f %f %f\n", p1, color_adjust[p1][0], color_adjust[p1][1],color_adjust[p1][2]);
- }
-
V1 = gsl_vector_get(c, 0);
V2 = gsl_vector_get(c, 1);
fprintf(stderr, "==> V1 %f V2 %f\n", V1, V2);
@@ -259,7 +231,7 @@ int
Stitch::color_correct(int c, double a, int pic, int color) {
double cd = (double) c;
- cd = cd * (color_adjust[pic][color] +
+ cd = cd * (1.0 +
V1 * a * a +
V2 * a * a * a * a);