Misc. comment typo fixes

Found via `codespell`
This commit is contained in:
luz.paz 2018-11-23 07:07:38 -05:00
parent 822ba6ae18
commit e0ccb7da7d
4 changed files with 169 additions and 171 deletions

View File

@ -2773,8 +2773,8 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
} }
} else if(cp.EDmet == 1) { //threshold adjuster } else if(cp.EDmet == 1) { //threshold adjuster
float MaxPCompare = MaxP[level] * SQR(cp.edg_max / 100.f); //100 instead of b_r...case if b_r < 100 float MaxPCompare = MaxP[level] * SQR(cp.edg_max / 100.f); //100 instead of b_r...case if b_r < 100
float MaxNCompare = MaxN[level] * SQR(cp.edg_max / 100.f); //always rduce a little edge for near max values float MaxNCompare = MaxN[level] * SQR(cp.edg_max / 100.f); //always reduce a little edge for near max values
float edgeSdCompare = (mean[level] + 1.5f * sigma[level]) * SQR(cp.edg_sd / t_r); // 1.5 standard deviation #80% range between mean 50% and 80% float edgeSdCompare = (mean[level] + 1.5f * sigma[level]) * SQR(cp.edg_sd / t_r); // 1.5 standard deviation #80% range between mean 50% and 80%
float edgeMeanCompare = mean[level] * SQR(cp.edg_mean / t_l); float edgeMeanCompare = mean[level] * SQR(cp.edg_mean / t_l);
float edgeLowCompare = (5.f + SQR(cp.edg_low)); float edgeLowCompare = (5.f + SQR(cp.edg_low));
float edgeMeanFactor = cbrt(cp.edg_mean / t_l); float edgeMeanFactor = cbrt(cp.edg_mean / t_l);
@ -2818,7 +2818,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
edge = edgePrecalc; edge = edgePrecalc;
} }
//algorithm that take into account local contrast //algorithm that takes into account local contrast
// I use a thresholdadjuster with // I use a thresholdadjuster with
// Bottom left ==> minimal low value for local contrast (not 0, but 5...we can change) // Bottom left ==> minimal low value for local contrast (not 0, but 5...we can change)
// 0 10*10 35*35 100*100 substantially correspond to the true distribution of low value, mean, standard-deviation and max (ed 5, 50, 400, 4000 // 0 10*10 35*35 100*100 substantially correspond to the true distribution of low value, mean, standard-deviation and max (ed 5, 50, 400, 4000
@ -2866,7 +2866,7 @@ void ImProcFunctions::ContAllL (float *koeLi[12], float *maxkoeLi, bool lipschit
if(edge < 1.f) { if(edge < 1.f) {
edge = 1.f; edge = 1.f;
} }
}//mofify effect if sd change }//modify effect if sd change
if (fabs(WavCoeffs_L[dir][k]) < edgeMeanCompare) { if (fabs(WavCoeffs_L[dir][k]) < edgeMeanCompare) {
edge *= edgeMeanFactor; edge *= edgeMeanFactor;

View File

@ -23,14 +23,14 @@ typedef float *_FloatWindow;
/********************************************************************* /*********************************************************************
* _interpolate * _interpolate
* *
* Given a point (x,y) in an image, computes the bilinear interpolated * Given a point (x,y) in an image, computes the bilinear interpolated
* gray-level value of the point in the image. * gray-level value of the point in the image.
*/ */
static float _interpolate( static float _interpolate(
float x, float x,
float y, float y,
_KLT_FloatImage img) _KLT_FloatImage img)
{ {
int xt = (int) x; /* coordinates of top-left corner */ int xt = (int) x; /* coordinates of top-left corner */
@ -61,7 +61,7 @@ static float _interpolate(
* _computeIntensityDifference * _computeIntensityDifference
* *
* Given two images and the window center in both images, * Given two images and the window center in both images,
* aligns the images wrt the window and computes the difference * aligns the images wrt the window and computes the difference
* between the two overlaid images. * between the two overlaid images.
*/ */
@ -91,7 +91,7 @@ static void _computeIntensityDifference(
* _computeGradientSum * _computeGradientSum
* *
* Given two gradients and the window center in both images, * Given two gradients and the window center in both images,
* aligns the gradients wrt the window and computes the sum of the two * aligns the gradients wrt the window and computes the sum of the two
* overlaid gradients. * overlaid gradients.
*/ */
@ -126,7 +126,7 @@ static void _computeGradientSum(
* _computeIntensityDifferenceLightingInsensitive * _computeIntensityDifferenceLightingInsensitive
* *
* Given two images and the window center in both images, * Given two images and the window center in both images,
* aligns the images wrt the window and computes the difference * aligns the images wrt the window and computes the difference
* between the two overlaid images; normalizes for overall gain and bias. * between the two overlaid images; normalizes for overall gain and bias.
*/ */
@ -141,7 +141,7 @@ static void _computeIntensityDifferenceLightingInsensitive(
int hw = width/2, hh = height/2; int hw = width/2, hh = height/2;
float g1, g2, sum1_squared = 0, sum2_squared = 0; float g1, g2, sum1_squared = 0, sum2_squared = 0;
int i, j; int i, j;
float sum1 = 0, sum2 = 0; float sum1 = 0, sum2 = 0;
float mean1, mean2,alpha,belta; float mean1, mean2,alpha,belta;
/* Compute values */ /* Compute values */
@ -165,7 +165,7 @@ static void _computeIntensityDifferenceLightingInsensitive(
g1 = _interpolate(x1+i, y1+j, img1); g1 = _interpolate(x1+i, y1+j, img1);
g2 = _interpolate(x2+i, y2+j, img2); g2 = _interpolate(x2+i, y2+j, img2);
*imgdiff++ = g1- g2*alpha-belta; *imgdiff++ = g1- g2*alpha-belta;
} }
} }
@ -173,7 +173,7 @@ static void _computeIntensityDifferenceLightingInsensitive(
* _computeGradientSumLightingInsensitive * _computeGradientSumLightingInsensitive
* *
* Given two gradients and the window center in both images, * Given two gradients and the window center in both images,
* aligns the gradients wrt the window and computes the sum of the two * aligns the gradients wrt the window and computes the sum of the two
* overlaid gradients; normalizes for overall gain and bias. * overlaid gradients; normalizes for overall gain and bias.
*/ */
@ -184,7 +184,7 @@ static void _computeGradientSumLightingInsensitive(
_KLT_FloatImage grady2, _KLT_FloatImage grady2,
_KLT_FloatImage img1, /* images */ _KLT_FloatImage img1, /* images */
_KLT_FloatImage img2, _KLT_FloatImage img2,
float x1, float y1, /* center of window in 1st img */ float x1, float y1, /* center of window in 1st img */
float x2, float y2, /* center of window in 2nd img */ float x2, float y2, /* center of window in 2nd img */
int width, int height, /* size of window */ int width, int height, /* size of window */
@ -194,7 +194,7 @@ static void _computeGradientSumLightingInsensitive(
int hw = width/2, hh = height/2; int hw = width/2, hh = height/2;
float g1, g2, sum1_squared = 0, sum2_squared = 0; float g1, g2, sum1_squared = 0, sum2_squared = 0;
int i, j; int i, j;
float mean1, mean2, alpha; float mean1, mean2, alpha;
for (j = -hh ; j <= hh ; j++) for (j = -hh ; j <= hh ; j++)
for (i = -hw ; i <= hw ; i++) { for (i = -hw ; i <= hw ; i++) {
@ -205,7 +205,7 @@ static void _computeGradientSumLightingInsensitive(
mean1 = sum1_squared/(width*height); mean1 = sum1_squared/(width*height);
mean2 = sum2_squared/(width*height); mean2 = sum2_squared/(width*height);
alpha = (float) sqrt(mean1/mean2); alpha = (float) sqrt(mean1/mean2);
/* Compute values */ /* Compute values */
for (j = -hh ; j <= hh ; j++) for (j = -hh ; j <= hh ; j++)
for (i = -hw ; i <= hw ; i++) { for (i = -hw ; i <= hw ; i++) {
@ -215,7 +215,7 @@ static void _computeGradientSumLightingInsensitive(
g1 = _interpolate(x1+i, y1+j, grady1); g1 = _interpolate(x1+i, y1+j, grady1);
g2 = _interpolate(x2+i, y2+j, grady2); g2 = _interpolate(x2+i, y2+j, grady2);
*grady++ = g1+ g2*alpha; *grady++ = g1+ g2*alpha;
} }
} }
/********************************************************************* /*********************************************************************
@ -229,8 +229,8 @@ static void _compute2by2GradientMatrix(
int width, /* size of window */ int width, /* size of window */
int height, int height,
float *gxx, /* return values */ float *gxx, /* return values */
float *gxy, float *gxy,
float *gyy) float *gyy)
{ {
float gx, gy; float gx, gy;
@ -246,8 +246,8 @@ static void _compute2by2GradientMatrix(
*gyy += gy*gy; *gyy += gy*gy;
} }
} }
/********************************************************************* /*********************************************************************
* _compute2by1ErrorVector * _compute2by1ErrorVector
* *
@ -267,7 +267,7 @@ static void _compute2by1ErrorVector(
int i; int i;
/* Compute values */ /* Compute values */
*ex = 0; *ey = 0; *ex = 0; *ey = 0;
for (i = 0 ; i < width * height ; i++) { for (i = 0 ; i < width * height ; i++) {
diff = *imgdiff++; diff = *imgdiff++;
*ex += diff * (*gradx++); *ex += diff * (*gradx++);
@ -297,7 +297,7 @@ static int _solveEquation(
{ {
float det = gxx*gyy - gxy*gxy; float det = gxx*gyy - gxy*gxy;
if (det < small) return KLT_SMALL_DET; if (det < small) return KLT_SMALL_DET;
*dx = (gyy*ex - gxy*ey)/det; *dx = (gyy*ex - gxy*ey)/det;
@ -309,7 +309,7 @@ static int _solveEquation(
/********************************************************************* /*********************************************************************
* _allocateFloatWindow * _allocateFloatWindow
*/ */
static _FloatWindow _allocateFloatWindow( static _FloatWindow _allocateFloatWindow(
int width, int width,
int height) int height)
@ -347,7 +347,7 @@ static void _printFloatWindow(
} }
} }
*/ */
/********************************************************************* /*********************************************************************
* _sumAbsFloatWindow * _sumAbsFloatWindow
@ -385,10 +385,10 @@ static int _trackFeature(
float y1, float y1,
float *x2, /* starting location of search in second image */ float *x2, /* starting location of search in second image */
float *y2, float *y2,
_KLT_FloatImage img1, _KLT_FloatImage img1,
_KLT_FloatImage gradx1, _KLT_FloatImage gradx1,
_KLT_FloatImage grady1, _KLT_FloatImage grady1,
_KLT_FloatImage img2, _KLT_FloatImage img2,
_KLT_FloatImage gradx2, _KLT_FloatImage gradx2,
_KLT_FloatImage grady2, _KLT_FloatImage grady2,
int width, /* size of window */ int width, /* size of window */
@ -410,7 +410,7 @@ static int _trackFeature(
int nr = img1->nrows; int nr = img1->nrows;
float one_plus_eps = 1.001f; /* To prevent rounding errors */ float one_plus_eps = 1.001f; /* To prevent rounding errors */
/* Allocate memory for windows */ /* Allocate memory for windows */
imgdiff = _allocateFloatWindow(width, height); imgdiff = _allocateFloatWindow(width, height);
gradx = _allocateFloatWindow(width, height); gradx = _allocateFloatWindow(width, height);
@ -430,24 +430,24 @@ static int _trackFeature(
/* Compute gradient and difference windows */ /* Compute gradient and difference windows */
if (lighting_insensitive) { if (lighting_insensitive) {
_computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2, _computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2,
width, height, imgdiff); width, height, imgdiff);
_computeGradientSumLightingInsensitive(gradx1, grady1, gradx2, grady2, _computeGradientSumLightingInsensitive(gradx1, grady1, gradx2, grady2,
img1, img2, x1, y1, *x2, *y2, width, height, gradx, grady); img1, img2, x1, y1, *x2, *y2, width, height, gradx, grady);
} else { } else {
_computeIntensityDifference(img1, img2, x1, y1, *x2, *y2, _computeIntensityDifference(img1, img2, x1, y1, *x2, *y2,
width, height, imgdiff); width, height, imgdiff);
_computeGradientSum(gradx1, grady1, gradx2, grady2, _computeGradientSum(gradx1, grady1, gradx2, grady2,
x1, y1, *x2, *y2, width, height, gradx, grady); x1, y1, *x2, *y2, width, height, gradx, grady);
} }
/* Use these windows to construct matrices */ /* Use these windows to construct matrices */
_compute2by2GradientMatrix(gradx, grady, width, height, _compute2by2GradientMatrix(gradx, grady, width, height,
&gxx, &gxy, &gyy); &gxx, &gxy, &gyy);
_compute2by1ErrorVector(imgdiff, gradx, grady, width, height, step_factor, _compute2by1ErrorVector(imgdiff, gradx, grady, width, height, step_factor,
&ex, &ey); &ex, &ey);
/* Using matrices, solve equation for new displacement */ /* Using matrices, solve equation for new displacement */
status = _solveEquation(gxx, gxy, gyy, ex, ey, small, &dx, &dy); status = _solveEquation(gxx, gxy, gyy, ex, ey, small, &dx, &dy);
if (status == KLT_SMALL_DET) break; if (status == KLT_SMALL_DET) break;
@ -459,19 +459,19 @@ static int _trackFeature(
} while ((fabs(dx)>=th || fabs(dy)>=th) && iteration < max_iterations); } while ((fabs(dx)>=th || fabs(dy)>=th) && iteration < max_iterations);
/* Check whether window is out of bounds */ /* Check whether window is out of bounds */
if (*x2-hw < 0.0f || nc-(*x2+hw) < one_plus_eps || if (*x2-hw < 0.0f || nc-(*x2+hw) < one_plus_eps ||
*y2-hh < 0.0f || nr-(*y2+hh) < one_plus_eps) *y2-hh < 0.0f || nr-(*y2+hh) < one_plus_eps)
status = KLT_OOB; status = KLT_OOB;
/* Check whether residue is too large */ /* Check whether residue is too large */
if (status == KLT_TRACKED) { if (status == KLT_TRACKED) {
if (lighting_insensitive) if (lighting_insensitive)
_computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2, _computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2,
width, height, imgdiff); width, height, imgdiff);
else else
_computeIntensityDifference(img1, img2, x1, y1, *x2, *y2, _computeIntensityDifference(img1, img2, x1, y1, *x2, *y2,
width, height, imgdiff); width, height, imgdiff);
if (_sumAbsFloatWindow(imgdiff, width, height)/(width*height) > max_residue) if (_sumAbsFloatWindow(imgdiff, width, height)/(width*height) > max_residue)
status = KLT_LARGE_RESIDUE; status = KLT_LARGE_RESIDUE;
} }
@ -505,25 +505,25 @@ static KLT_BOOL _outOfBounds(
/********************************************************************** /**********************************************************************
* CONSISTENCY CHECK OF FEATURES BY AFFINE MAPPING (BEGIN) * CONSISTENCY CHECK OF FEATURES BY AFFINE MAPPING (BEGIN)
* *
* Created by: Thorsten Thormaehlen (University of Hannover) June 2004 * Created by: Thorsten Thormaehlen (University of Hannover) June 2004
* thormae@tnt.uni-hannover.de * thormae@tnt.uni-hannover.de
* *
* Permission is granted to any individual or institution to use, copy, modify, * Permission is granted to any individual or institution to use, copy, modify,
* and distribute this part of the software, provided that this complete authorship * and distribute this part of the software, provided that this complete authorship
* and permission notice is maintained, intact, in all copies. * and permission notice is maintained, intact, in all copies.
* *
* This software is provided "as is" without express or implied warranty. * This software is provided "as is" without express or implied warranty.
* *
* *
* The following static functions are helpers for the affine mapping. * The following static functions are helpers for the affine mapping.
* They all start with "_am". * They all start with "_am".
* There are also small changes in other files for the * There are also small changes in other files for the
* affine mapping these are all marked by "for affine mapping" * affine mapping these are all marked by "for affine mapping"
* *
* Thanks to Kevin Koeser (koeser@mip.informatik.uni-kiel.de) for fixing a bug * Thanks to Kevin Koeser (koeser@mip.informatik.uni-kiel.de) for fixing a bug
*/ */
#define SWAP_ME(X,Y) {temp=(X);(X)=(Y);(Y)=temp;} #define SWAP_ME(X,Y) {temp=(X);(X)=(Y);(Y)=temp;}
@ -613,7 +613,7 @@ static int _am_gauss_jordan_elimination(float **a, int n, float **b, int m)
/********************************************************************* /*********************************************************************
* _am_getGradientWinAffine * _am_getGradientWinAffine
* *
* aligns the gradients with the affine transformed window * aligns the gradients with the affine transformed window
*/ */
static void _am_getGradientWinAffine( static void _am_getGradientWinAffine(
@ -628,7 +628,7 @@ static void _am_getGradientWinAffine(
int hw = width/2, hh = height/2; int hw = width/2, hh = height/2;
int i, j; int i, j;
float mi, mj; float mi, mj;
/* Compute values */ /* Compute values */
for (j = -hh ; j <= hh ; j++) for (j = -hh ; j <= hh ; j++)
for (i = -hw ; i <= hw ; i++) { for (i = -hw ; i <= hw ; i++) {
@ -637,19 +637,19 @@ static void _am_getGradientWinAffine(
*out_gradx++ = _interpolate(x+mi, y+mj, in_gradx); *out_gradx++ = _interpolate(x+mi, y+mj, in_gradx);
*out_grady++ = _interpolate(x+mi, y+mj, in_grady); *out_grady++ = _interpolate(x+mi, y+mj, in_grady);
} }
} }
///********************************************************************* ///*********************************************************************
// * _computeAffineMappedImage // * _computeAffineMappedImage
// * used only for DEBUG output // * used only for DEBUG output
// * // *
//*/ //*/
// //
//static void _am_computeAffineMappedImage( //static void _am_computeAffineMappedImage(
// _KLT_FloatImage img, /* images */ // _KLT_FloatImage img, /* images */
// float x, float y, /* center of window */ // float x, float y, /* center of window */
// float Axx, float Ayx , float Axy, float Ayy, /* affine mapping */ // float Axx, float Ayx , float Axy, float Ayy, /* affine mapping */
// int width, int height, /* size of window */ // int width, int height, /* size of window */
// _FloatWindow imgdiff) /* output */ // _FloatWindow imgdiff) /* output */
//{ //{
@ -679,14 +679,14 @@ static void _am_getSubFloatImage(
int hw = window->ncols/2, hh = window->nrows/2; int hw = window->ncols/2, hh = window->nrows/2;
int x0 = (int) x; int x0 = (int) x;
int y0 = (int) y; int y0 = (int) y;
float * windata = window->data; float * windata = window->data;
int offset; int offset;
int i, j; int i, j;
assert(x0 - hw >= 0); assert(x0 - hw >= 0);
assert(y0 - hh >= 0); assert(y0 - hh >= 0);
assert(x0 + hw <= img->ncols); assert(x0 + hw <= img->ncols);
assert(y0 + hh <= img->nrows); assert(y0 + hh <= img->nrows);
/* copy values */ /* copy values */
for (j = -hh ; j <= hh ; j++) for (j = -hh ; j <= hh ; j++)
@ -700,10 +700,10 @@ static void _am_getSubFloatImage(
* _am_computeIntensityDifferenceAffine * _am_computeIntensityDifferenceAffine
* *
* Given two images and the window center in both images, * Given two images and the window center in both images,
* aligns the images with the window and computes the difference * aligns the images with the window and computes the difference
* between the two overlaid images using the affine mapping. * between the two overlaid images using the affine mapping.
* A = [ Axx Axy] * A = [ Axx Axy]
* [ Ayx Ayy] * [ Ayx Ayy]
*/ */
static void _am_computeIntensityDifferenceAffine( static void _am_computeIntensityDifferenceAffine(
@ -711,7 +711,7 @@ static void _am_computeIntensityDifferenceAffine(
_KLT_FloatImage img2, _KLT_FloatImage img2,
float x1, float y1, /* center of window in 1st img */ float x1, float y1, /* center of window in 1st img */
float x2, float y2, /* center of window in 2nd img */ float x2, float y2, /* center of window in 2nd img */
float Axx, float Ayx , float Axy, float Ayy, /* affine mapping */ float Axx, float Ayx , float Axy, float Ayy, /* affine mapping */
int width, int height, /* size of window */ int width, int height, /* size of window */
_FloatWindow imgdiff) /* output */ _FloatWindow imgdiff) /* output */
{ {
@ -746,15 +746,15 @@ static void _am_compute6by6GradientMatrix(
int hw = width/2, hh = height/2; int hw = width/2, hh = height/2;
int i, j; int i, j;
float gx, gy, gxx, gxy, gyy, x, y, xx, xy, yy; float gx, gy, gxx, gxy, gyy, x, y, xx, xy, yy;
/* Set values to zero */ /* Set values to zero */
for (j = 0 ; j < 6 ; j++) { for (j = 0 ; j < 6 ; j++) {
for (i = j ; i < 6 ; i++) { for (i = j ; i < 6 ; i++) {
T[j][i] = 0.0; T[j][i] = 0.0;
} }
} }
for (j = -hh ; j <= hh ; j++) { for (j = -hh ; j <= hh ; j++) {
for (i = -hw ; i <= hw ; i++) { for (i = -hw ; i <= hw ; i++) {
gx = *gradx++; gx = *gradx++;
@ -762,41 +762,41 @@ static void _am_compute6by6GradientMatrix(
gxx = gx * gx; gxx = gx * gx;
gxy = gx * gy; gxy = gx * gy;
gyy = gy * gy; gyy = gy * gy;
x = (float) i; x = (float) i;
y = (float) j; y = (float) j;
xx = x * x; xx = x * x;
xy = x * y; xy = x * y;
yy = y * y; yy = y * y;
T[0][0] += xx * gxx; T[0][0] += xx * gxx;
T[0][1] += xx * gxy; T[0][1] += xx * gxy;
T[0][2] += xy * gxx; T[0][2] += xy * gxx;
T[0][3] += xy * gxy; T[0][3] += xy * gxy;
T[0][4] += x * gxx; T[0][4] += x * gxx;
T[0][5] += x * gxy; T[0][5] += x * gxy;
T[1][1] += xx * gyy; T[1][1] += xx * gyy;
T[1][2] += xy * gxy; T[1][2] += xy * gxy;
T[1][3] += xy * gyy; T[1][3] += xy * gyy;
T[1][4] += x * gxy; T[1][4] += x * gxy;
T[1][5] += x * gyy; T[1][5] += x * gyy;
T[2][2] += yy * gxx; T[2][2] += yy * gxx;
T[2][3] += yy * gxy; T[2][3] += yy * gxy;
T[2][4] += y * gxx; T[2][4] += y * gxx;
T[2][5] += y * gxy; T[2][5] += y * gxy;
T[3][3] += yy * gyy; T[3][3] += yy * gyy;
T[3][4] += y * gxy; T[3][4] += y * gxy;
T[3][5] += y * gyy; T[3][5] += y * gyy;
T[4][4] += gxx; T[4][4] += gxx;
T[4][5] += gxy; T[4][5] += gxy;
T[5][5] += gyy; T[5][5] += gyy;
} }
} }
for (j = 0 ; j < 5 ; j++) { for (j = 0 ; j < 5 ; j++) {
for (i = j+1 ; i < 6 ; i++) { for (i = j+1 ; i < 6 ; i++) {
T[i][j] = T[j][i]; T[i][j] = T[j][i];
@ -824,9 +824,9 @@ static void _am_compute6by1ErrorVector(
int i, j; int i, j;
float diff, diffgradx, diffgrady; float diff, diffgradx, diffgrady;
/* Set values to zero */ /* Set values to zero */
for(i = 0; i < 6; i++) e[i][0] = 0.0; for(i = 0; i < 6; i++) e[i][0] = 0.0;
/* Compute values */ /* Compute values */
for (j = -hh ; j <= hh ; j++) { for (j = -hh ; j <= hh ; j++) {
for (i = -hw ; i <= hw ; i++) { for (i = -hw ; i <= hw ; i++) {
@ -835,15 +835,15 @@ static void _am_compute6by1ErrorVector(
diffgrady = diff * (*grady++); diffgrady = diff * (*grady++);
e[0][0] += diffgradx * i; e[0][0] += diffgradx * i;
e[1][0] += diffgrady * i; e[1][0] += diffgrady * i;
e[2][0] += diffgradx * j; e[2][0] += diffgradx * j;
e[3][0] += diffgrady * j; e[3][0] += diffgrady * j;
e[4][0] += diffgradx; e[4][0] += diffgradx;
e[5][0] += diffgrady; e[5][0] += diffgrady;
} }
} }
for(i = 0; i < 6; i++) e[i][0] *= 0.5; for(i = 0; i < 6; i++) e[i][0] *= 0.5;
} }
@ -862,37 +862,37 @@ static void _am_compute4by4GradientMatrix(
int hw = width/2, hh = height/2; int hw = width/2, hh = height/2;
int i, j; int i, j;
float gx, gy, x, y; float gx, gy, x, y;
/* Set values to zero */ /* Set values to zero */
for (j = 0 ; j < 4 ; j++) { for (j = 0 ; j < 4 ; j++) {
for (i = 0 ; i < 4 ; i++) { for (i = 0 ; i < 4 ; i++) {
T[j][i] = 0.0; T[j][i] = 0.0;
} }
} }
for (j = -hh ; j <= hh ; j++) { for (j = -hh ; j <= hh ; j++) {
for (i = -hw ; i <= hw ; i++) { for (i = -hw ; i <= hw ; i++) {
gx = *gradx++; gx = *gradx++;
gy = *grady++; gy = *grady++;
x = (float) i; x = (float) i;
y = (float) j; y = (float) j;
T[0][0] += (x*gx+y*gy) * (x*gx+y*gy); T[0][0] += (x*gx+y*gy) * (x*gx+y*gy);
T[0][1] += (x*gx+y*gy)*(x*gy-y*gx); T[0][1] += (x*gx+y*gy)*(x*gy-y*gx);
T[0][2] += (x*gx+y*gy)*gx; T[0][2] += (x*gx+y*gy)*gx;
T[0][3] += (x*gx+y*gy)*gy; T[0][3] += (x*gx+y*gy)*gy;
T[1][1] += (x*gy-y*gx) * (x*gy-y*gx); T[1][1] += (x*gy-y*gx) * (x*gy-y*gx);
T[1][2] += (x*gy-y*gx)*gx; T[1][2] += (x*gy-y*gx)*gx;
T[1][3] += (x*gy-y*gx)*gy; T[1][3] += (x*gy-y*gx)*gy;
T[2][2] += gx*gx; T[2][2] += gx*gx;
T[2][3] += gx*gy; T[2][3] += gx*gy;
T[3][3] += gy*gy; T[3][3] += gy*gy;
} }
} }
for (j = 0 ; j < 3 ; j++) { for (j = 0 ; j < 3 ; j++) {
for (i = j+1 ; i < 4 ; i++) { for (i = j+1 ; i < 4 ; i++) {
T[i][j] = T[j][i]; T[i][j] = T[j][i];
@ -918,9 +918,9 @@ static void _am_compute4by1ErrorVector(
int i, j; int i, j;
float diff, diffgradx, diffgrady; float diff, diffgradx, diffgrady;
/* Set values to zero */ /* Set values to zero */
for(i = 0; i < 4; i++) e[i][0] = 0.0; for(i = 0; i < 4; i++) e[i][0] = 0.0;
/* Compute values */ /* Compute values */
for (j = -hh ; j <= hh ; j++) { for (j = -hh ; j <= hh ; j++) {
for (i = -hw ; i <= hw ; i++) { for (i = -hw ; i <= hw ; i++) {
@ -933,9 +933,9 @@ static void _am_compute4by1ErrorVector(
e[3][0] += diffgrady; e[3][0] += diffgrady;
} }
} }
for(i = 0; i < 4; i++) e[i][0] *= 0.5; for(i = 0; i < 4; i++) e[i][0] *= 0.5;
} }
@ -950,7 +950,7 @@ static void _am_compute4by1ErrorVector(
* KLT_TRACKED otherwise. * KLT_TRACKED otherwise.
*/ */
/* if you enalbe the DEBUG_AFFINE_MAPPING make sure you have created a directory "./debug" */ /* if you enable the DEBUG_AFFINE_MAPPING make sure you have created a directory "./debug" */
/* #define DEBUG_AFFINE_MAPPING */ /* #define DEBUG_AFFINE_MAPPING */
#ifdef DEBUG_AFFINE_MAPPING #ifdef DEBUG_AFFINE_MAPPING
@ -963,10 +963,10 @@ static int _am_trackFeatureAffine(
float y1, float y1,
float *x2, /* starting location of search in second image */ float *x2, /* starting location of search in second image */
float *y2, float *y2,
_KLT_FloatImage img1, _KLT_FloatImage img1,
_KLT_FloatImage gradx1, _KLT_FloatImage gradx1,
_KLT_FloatImage grady1, _KLT_FloatImage grady1,
_KLT_FloatImage img2, _KLT_FloatImage img2,
_KLT_FloatImage gradx2, _KLT_FloatImage gradx2,
_KLT_FloatImage grady2, _KLT_FloatImage grady2,
int width, /* size of window */ int width, /* size of window */
@ -980,7 +980,7 @@ static int _am_trackFeatureAffine(
int lighting_insensitive, /* whether to normalize for gain and bias */ int lighting_insensitive, /* whether to normalize for gain and bias */
int affine_map, /* whether to evaluates the consistency of features with affine mapping */ int affine_map, /* whether to evaluates the consistency of features with affine mapping */
float mdd, /* difference between the displacements */ float mdd, /* difference between the displacements */
float *Axx, float *Ayx, float *Axx, float *Ayx,
float *Axy, float *Ayy) /* used affine mapping */ float *Axy, float *Ayy) /* used affine mapping */
{ {
@ -996,7 +996,7 @@ static int _am_trackFeatureAffine(
int nc2 = img2->ncols; int nc2 = img2->ncols;
int nr2 = img2->nrows; int nr2 = img2->nrows;
float **a; float **a;
float **T; float **T;
float one_plus_eps = 1.001f; /* To prevent rounding errors */ float one_plus_eps = 1.001f; /* To prevent rounding errors */
float old_x2 = *x2; float old_x2 = *x2;
float old_y2 = *y2; float old_y2 = *y2;
@ -1007,7 +1007,7 @@ static int _am_trackFeatureAffine(
_KLT_FloatImage aff_diff_win = _KLTCreateFloatImage(width,height); _KLT_FloatImage aff_diff_win = _KLTCreateFloatImage(width,height);
printf("starting location x2=%f y2=%f\n", *x2, *y2); printf("starting location x2=%f y2=%f\n", *x2, *y2);
#endif #endif
/* Allocate memory for windows */ /* Allocate memory for windows */
imgdiff = _allocateFloatWindow(width, height); imgdiff = _allocateFloatWindow(width, height);
gradx = _allocateFloatWindow(width, height); gradx = _allocateFloatWindow(width, height);
@ -1019,7 +1019,7 @@ static int _am_trackFeatureAffine(
do { do {
if(!affine_map) { if(!affine_map) {
/* pure translation tracker */ /* pure translation tracker */
/* If out of bounds, exit loop */ /* If out of bounds, exit loop */
if ( x1-hw < 0.0f || nc1-( x1+hw) < one_plus_eps || if ( x1-hw < 0.0f || nc1-( x1+hw) < one_plus_eps ||
*x2-hw < 0.0f || nc2-(*x2+hw) < one_plus_eps || *x2-hw < 0.0f || nc2-(*x2+hw) < one_plus_eps ||
@ -1028,47 +1028,47 @@ static int _am_trackFeatureAffine(
status = KLT_OOB; status = KLT_OOB;
break; break;
} }
/* Compute gradient and difference windows */ /* Compute gradient and difference windows */
if (lighting_insensitive) { if (lighting_insensitive) {
_computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2, _computeIntensityDifferenceLightingInsensitive(img1, img2, x1, y1, *x2, *y2,
width, height, imgdiff); width, height, imgdiff);
_computeGradientSumLightingInsensitive(gradx1, grady1, gradx2, grady2, _computeGradientSumLightingInsensitive(gradx1, grady1, gradx2, grady2,
img1, img2, x1, y1, *x2, *y2, width, height, gradx, grady); img1, img2, x1, y1, *x2, *y2, width, height, gradx, grady);
} else { } else {
_computeIntensityDifference(img1, img2, x1, y1, *x2, *y2, _computeIntensityDifference(img1, img2, x1, y1, *x2, *y2,
width, height, imgdiff); width, height, imgdiff);
_computeGradientSum(gradx1, grady1, gradx2, grady2, _computeGradientSum(gradx1, grady1, gradx2, grady2,
x1, y1, *x2, *y2, width, height, gradx, grady); x1, y1, *x2, *y2, width, height, gradx, grady);
} }
#ifdef DEBUG_AFFINE_MAPPING #ifdef DEBUG_AFFINE_MAPPING
aff_diff_win->data = imgdiff; aff_diff_win->data = imgdiff;
sprintf(fname, "./debug/kltimg_trans_diff_win%03d.%03d.pgm", glob_index, counter); sprintf(fname, "./debug/kltimg_trans_diff_win%03d.%03d.pgm", glob_index, counter);
printf("%s\n", fname); printf("%s\n", fname);
_KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0); _KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0);
printf("iter = %d translation tracker res: %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height)); printf("iter = %d translation tracker res: %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height));
#endif #endif
/* Use these windows to construct matrices */ /* Use these windows to construct matrices */
_compute2by2GradientMatrix(gradx, grady, width, height, _compute2by2GradientMatrix(gradx, grady, width, height,
&gxx, &gxy, &gyy); &gxx, &gxy, &gyy);
_compute2by1ErrorVector(imgdiff, gradx, grady, width, height, step_factor, _compute2by1ErrorVector(imgdiff, gradx, grady, width, height, step_factor,
&ex, &ey); &ex, &ey);
/* Using matrices, solve equation for new displacement */ /* Using matrices, solve equation for new displacement */
status = _solveEquation(gxx, gxy, gyy, ex, ey, small, &dx, &dy); status = _solveEquation(gxx, gxy, gyy, ex, ey, small, &dx, &dy);
convergence = (fabs(dx) < th && fabs(dy) < th); convergence = (fabs(dx) < th && fabs(dy) < th);
*x2 += dx; *x2 += dx;
*y2 += dy; *y2 += dy;
}else{ }else{
/* affine tracker */ /* affine tracker */
float ul_x = *Axx * (-hw) + *Axy * hh + *x2; /* upper left corner */ float ul_x = *Axx * (-hw) + *Axy * hh + *x2; /* upper left corner */
float ul_y = *Ayx * (-hw) + *Ayy * hh + *y2; float ul_y = *Ayx * (-hw) + *Ayy * hh + *y2;
float ll_x = *Axx * (-hw) + *Axy * (-hh) + *x2; /* lower left corner */ float ll_x = *Axx * (-hw) + *Axy * (-hh) + *x2; /* lower left corner */
float ll_y = *Ayx * (-hw) + *Ayy * (-hh) + *y2; float ll_y = *Ayx * (-hw) + *Ayy * (-hh) + *y2;
float ur_x = *Axx * hw + *Axy * hh + *x2; /* upper right corner */ float ur_x = *Axx * hw + *Axy * hh + *x2; /* upper right corner */
@ -1098,25 +1098,25 @@ static int _am_trackFeatureAffine(
sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_1.pgm", glob_index, counter); sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_1.pgm", glob_index, counter);
printf("%s\n", fname); printf("%s\n", fname);
_KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0); _KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0);
_am_computeAffineMappedImage(img2, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, width, height, imgdiff); _am_computeAffineMappedImage(img2, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, width, height, imgdiff);
aff_diff_win->data = imgdiff; aff_diff_win->data = imgdiff;
sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_2.pgm", glob_index, counter); sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_2.pgm", glob_index, counter);
printf("%s\n", fname); printf("%s\n", fname);
_KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0); _KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0);
#endif #endif
_am_computeIntensityDifferenceAffine(img1, img2, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, _am_computeIntensityDifferenceAffine(img1, img2, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy,
width, height, imgdiff); width, height, imgdiff);
#ifdef DEBUG_AFFINE_MAPPING #ifdef DEBUG_AFFINE_MAPPING
aff_diff_win->data = imgdiff; aff_diff_win->data = imgdiff;
sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_3.pgm", glob_index,counter); sprintf(fname, "./debug/kltimg_aff_diff_win%03d.%03d_3.pgm", glob_index,counter);
printf("%s\n", fname); printf("%s\n", fname);
_KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0); _KLTWriteAbsFloatImageToPGM(aff_diff_win, fname,256.0);
printf("iter = %d affine tracker res: %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height)); printf("iter = %d affine tracker res: %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height));
#endif #endif
_am_getGradientWinAffine(gradx2, grady2, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, _am_getGradientWinAffine(gradx2, grady2, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy,
width, height, gradx, grady); width, height, gradx, grady);
@ -1124,24 +1124,24 @@ static int _am_trackFeatureAffine(
case 1: case 1:
_am_compute4by1ErrorVector(imgdiff, gradx, grady, width, height, a); _am_compute4by1ErrorVector(imgdiff, gradx, grady, width, height, a);
_am_compute4by4GradientMatrix(gradx, grady, width, height, T); _am_compute4by4GradientMatrix(gradx, grady, width, height, T);
status = _am_gauss_jordan_elimination(T,4,a,1); status = _am_gauss_jordan_elimination(T,4,a,1);
*Axx += a[0][0]; *Axx += a[0][0];
*Ayx += a[1][0]; *Ayx += a[1][0];
*Ayy = *Axx; *Ayy = *Axx;
*Axy = -(*Ayx); *Axy = -(*Ayx);
dx = a[2][0]; dx = a[2][0];
dy = a[3][0]; dy = a[3][0];
break; break;
case 2: case 2:
_am_compute6by1ErrorVector(imgdiff, gradx, grady, width, height, a); _am_compute6by1ErrorVector(imgdiff, gradx, grady, width, height, a);
_am_compute6by6GradientMatrix(gradx, grady, width, height, T); _am_compute6by6GradientMatrix(gradx, grady, width, height, T);
status = _am_gauss_jordan_elimination(T,6,a,1); status = _am_gauss_jordan_elimination(T,6,a,1);
*Axx += a[0][0]; *Axx += a[0][0];
*Ayx += a[1][0]; *Ayx += a[1][0];
*Axy += a[2][0]; *Axy += a[2][0];
@ -1149,30 +1149,30 @@ static int _am_trackFeatureAffine(
dx = a[4][0]; dx = a[4][0];
dy = a[5][0]; dy = a[5][0];
break; break;
} }
*x2 += dx; *x2 += dx;
*y2 += dy; *y2 += dy;
/* old upper left corner - new upper left corner */ /* old upper left corner - new upper left corner */
ul_x -= *Axx * (-hw) + *Axy * hh + *x2; ul_x -= *Axx * (-hw) + *Axy * hh + *x2;
ul_y -= *Ayx * (-hw) + *Ayy * hh + *y2; ul_y -= *Ayx * (-hw) + *Ayy * hh + *y2;
/* old lower left corner - new lower left corner */ /* old lower left corner - new lower left corner */
ll_x -= *Axx * (-hw) + *Axy * (-hh) + *x2; ll_x -= *Axx * (-hw) + *Axy * (-hh) + *x2;
ll_y -= *Ayx * (-hw) + *Ayy * (-hh) + *y2; ll_y -= *Ayx * (-hw) + *Ayy * (-hh) + *y2;
/* old upper right corner - new upper right corner */ /* old upper right corner - new upper right corner */
ur_x -= *Axx * hw + *Axy * hh + *x2; ur_x -= *Axx * hw + *Axy * hh + *x2;
ur_y -= *Ayx * hw + *Ayy * hh + *y2; ur_y -= *Ayx * hw + *Ayy * hh + *y2;
/* old lower right corner - new lower right corner */ /* old lower right corner - new lower right corner */
lr_x -= *Axx * hw + *Axy * (-hh) + *x2; lr_x -= *Axx * hw + *Axy * (-hh) + *x2;
lr_y -= *Ayx * hw + *Ayy * (-hh) + *y2; lr_y -= *Ayx * hw + *Ayy * (-hh) + *y2;
#ifdef DEBUG_AFFINE_MAPPING #ifdef DEBUG_AFFINE_MAPPING
printf ("iter = %d, ul_x=%f ul_y=%f ll_x=%f ll_y=%f ur_x=%f ur_y=%f lr_x=%f lr_y=%f \n", printf ("iter = %d, ul_x=%f ul_y=%f ll_x=%f ll_y=%f ur_x=%f ur_y=%f lr_x=%f lr_y=%f \n",
iteration, ul_x, ul_y, ll_x, ll_y, ur_x, ur_y, lr_x, lr_y); iteration, ul_x, ul_y, ll_x, ll_y, ur_x, ur_y, lr_x, lr_y);
#endif #endif
convergence = (fabs(dx) < th && fabs(dy) < th && convergence = (fabs(dx) < th && fabs(dy) < th &&
fabs(ul_x) < th_aff && fabs(ul_y) < th_aff && fabs(ul_x) < th_aff && fabs(ul_y) < th_aff &&
@ -1180,19 +1180,19 @@ static int _am_trackFeatureAffine(
fabs(ur_x) < th_aff && fabs(ur_y) < th_aff && fabs(ur_x) < th_aff && fabs(ur_y) < th_aff &&
fabs(lr_x) < th_aff && fabs(lr_y) < th_aff); fabs(lr_x) < th_aff && fabs(lr_y) < th_aff);
} }
if (status == KLT_SMALL_DET) break; if (status == KLT_SMALL_DET) break;
iteration++; iteration++;
#ifdef DEBUG_AFFINE_MAPPING #ifdef DEBUG_AFFINE_MAPPING
printf ("iter = %d, x1=%f, y1=%f, x2=%f, y2=%f, Axx=%f, Ayx=%f , Axy=%f, Ayy=%f \n",iteration, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy); printf ("iter = %d, x1=%f, y1=%f, x2=%f, y2=%f, Axx=%f, Ayx=%f , Axy=%f, Ayy=%f \n",iteration, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy);
#endif #endif
} while ( !convergence && iteration < max_iterations); } while ( !convergence && iteration < max_iterations);
/*} while ( (fabs(dx)>=th || fabs(dy)>=th || (affine_map && iteration < 8) ) && iteration < max_iterations); */ /*} while ( (fabs(dx)>=th || fabs(dy)>=th || (affine_map && iteration < 8) ) && iteration < max_iterations); */
_am_free_matrix(T); _am_free_matrix(T);
_am_free_matrix(a); _am_free_matrix(a);
/* Check whether window is out of bounds */ /* Check whether window is out of bounds */
if (*x2-hw < 0.0f || nc2-(*x2+hw) < one_plus_eps || if (*x2-hw < 0.0f || nc2-(*x2+hw) < one_plus_eps ||
*y2-hh < 0.0f || nr2-(*y2+hh) < one_plus_eps) *y2-hh < 0.0f || nr2-(*y2+hh) < one_plus_eps)
status = KLT_OOB; status = KLT_OOB;
@ -1203,7 +1203,7 @@ static int _am_trackFeatureAffine(
/* Check whether residue is too large */ /* Check whether residue is too large */
if (status == KLT_TRACKED) { if (status == KLT_TRACKED) {
if(!affine_map){ if(!affine_map){
_computeIntensityDifference(img1, img2, x1, y1, *x2, *y2, _computeIntensityDifference(img1, img2, x1, y1, *x2, *y2,
width, height, imgdiff); width, height, imgdiff);
}else{ }else{
_am_computeIntensityDifferenceAffine(img1, img2, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy, _am_computeIntensityDifferenceAffine(img1, img2, x1, y1, *x2, *y2, *Axx, *Ayx , *Axy, *Ayy,
@ -1211,8 +1211,8 @@ static int _am_trackFeatureAffine(
} }
#ifdef DEBUG_AFFINE_MAPPING #ifdef DEBUG_AFFINE_MAPPING
printf("iter = %d final_res = %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height)); printf("iter = %d final_res = %f\n", iteration, _sumAbsFloatWindow(imgdiff, width, height)/(width*height));
#endif #endif
if (_sumAbsFloatWindow(imgdiff, width, height)/(width*height) > max_residue) if (_sumAbsFloatWindow(imgdiff, width, height)/(width*height) > max_residue)
status = KLT_LARGE_RESIDUE; status = KLT_LARGE_RESIDUE;
} }
@ -1222,8 +1222,8 @@ static int _am_trackFeatureAffine(
#ifdef DEBUG_AFFINE_MAPPING #ifdef DEBUG_AFFINE_MAPPING
printf("iter = %d status=%d\n", iteration, status); printf("iter = %d status=%d\n", iteration, status);
_KLTFreeFloatImage( aff_diff_win ); _KLTFreeFloatImage( aff_diff_win );
#endif #endif
/* Return appropriate value */ /* Return appropriate value */
return status; return status;
} }
@ -1313,7 +1313,7 @@ void KLTTrackFeatures(
pyramid1_gradx = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); pyramid1_gradx = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels);
pyramid1_grady = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); pyramid1_grady = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels);
for (i = 0 ; i < tc->nPyramidLevels ; i++) for (i = 0 ; i < tc->nPyramidLevels ; i++)
_KLTComputeGradients(pyramid1->img[i], tc->grad_sigma, _KLTComputeGradients(pyramid1->img[i], tc->grad_sigma,
pyramid1_gradx->img[i], pyramid1_gradx->img[i],
pyramid1_grady->img[i]); pyramid1_grady->img[i]);
} }
@ -1327,7 +1327,7 @@ void KLTTrackFeatures(
pyramid2_gradx = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); pyramid2_gradx = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels);
pyramid2_grady = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels); pyramid2_grady = _KLTCreatePyramid(ncols, nrows, (int) subsampling, tc->nPyramidLevels);
for (i = 0 ; i < tc->nPyramidLevels ; i++) for (i = 0 ; i < tc->nPyramidLevels ; i++)
_KLTComputeGradients(pyramid2->img[i], tc->grad_sigma, _KLTComputeGradients(pyramid2->img[i], tc->grad_sigma,
pyramid2_gradx->img[i], pyramid2_gradx->img[i],
pyramid2_grady->img[i]); pyramid2_grady->img[i]);
@ -1372,11 +1372,11 @@ void KLTTrackFeatures(
xloc *= subsampling; yloc *= subsampling; xloc *= subsampling; yloc *= subsampling;
xlocout *= subsampling; ylocout *= subsampling; xlocout *= subsampling; ylocout *= subsampling;
val = _trackFeature(xloc, yloc, val = _trackFeature(xloc, yloc,
&xlocout, &ylocout, &xlocout, &ylocout,
pyramid1->img[r], pyramid1->img[r],
pyramid1_gradx->img[r], pyramid1_grady->img[r], pyramid1_gradx->img[r], pyramid1_grady->img[r],
pyramid2->img[r], pyramid2->img[r],
pyramid2_gradx->img[r], pyramid2_grady->img[r], pyramid2_gradx->img[r], pyramid2_grady->img[r],
tc->window_width, tc->window_height, tc->window_width, tc->window_height,
tc->step_factor, tc->step_factor,
@ -1449,7 +1449,7 @@ void KLTTrackFeatures(
if (tc->affineConsistencyCheck >= 0 && val == KLT_TRACKED) { /*for affine mapping*/ if (tc->affineConsistencyCheck >= 0 && val == KLT_TRACKED) { /*for affine mapping*/
int border = 2; /* add border for interpolation */ int border = 2; /* add border for interpolation */
#ifdef DEBUG_AFFINE_MAPPING #ifdef DEBUG_AFFINE_MAPPING
glob_index = indx; glob_index = indx;
#endif #endif
@ -1467,10 +1467,10 @@ void KLTTrackFeatures(
/* affine tracking */ /* affine tracking */
val = _am_trackFeatureAffine(featurelist->feature[indx]->aff_x, featurelist->feature[indx]->aff_y, val = _am_trackFeatureAffine(featurelist->feature[indx]->aff_x, featurelist->feature[indx]->aff_y,
&xlocout, &ylocout, &xlocout, &ylocout,
featurelist->feature[indx]->aff_img, featurelist->feature[indx]->aff_img,
featurelist->feature[indx]->aff_img_gradx, featurelist->feature[indx]->aff_img_gradx,
featurelist->feature[indx]->aff_img_grady, featurelist->feature[indx]->aff_img_grady,
pyramid2->img[0], pyramid2->img[0],
pyramid2_gradx->img[0], pyramid2_grady->img[0], pyramid2_gradx->img[0], pyramid2_grady->img[0],
tc->affine_window_width, tc->affine_window_height, tc->affine_window_width, tc->affine_window_height,
tc->step_factor, tc->step_factor,
@ -1478,14 +1478,14 @@ void KLTTrackFeatures(
tc->min_determinant, tc->min_determinant,
tc->min_displacement, tc->min_displacement,
tc->affine_min_displacement, tc->affine_min_displacement,
tc->affine_max_residue, tc->affine_max_residue,
tc->lighting_insensitive, tc->lighting_insensitive,
tc->affineConsistencyCheck, tc->affineConsistencyCheck,
tc->affine_max_displacement_differ, tc->affine_max_displacement_differ,
&featurelist->feature[indx]->aff_Axx, &featurelist->feature[indx]->aff_Axx,
&featurelist->feature[indx]->aff_Ayx, &featurelist->feature[indx]->aff_Ayx,
&featurelist->feature[indx]->aff_Axy, &featurelist->feature[indx]->aff_Axy,
&featurelist->feature[indx]->aff_Ayy &featurelist->feature[indx]->aff_Ayy
); );
featurelist->feature[indx]->val = val; featurelist->feature[indx]->val = val;
if(val != KLT_TRACKED){ if(val != KLT_TRACKED){
@ -1538,5 +1538,3 @@ void KLTTrackFeatures(
} }
} }

View File

@ -44,7 +44,7 @@ CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDet
crop_custom_ratio(0.f) crop_custom_ratio(0.f)
{ {
initZoomSteps(); initZoomSteps();
Glib::RefPtr<Pango::Context> context = parent->get_pango_context () ; Glib::RefPtr<Pango::Context> context = parent->get_pango_context () ;
Pango::FontDescription fontd = context->get_font_description (); Pango::FontDescription fontd = context->get_font_description ();
fontd.set_weight (Pango::WEIGHT_BOLD); fontd.set_weight (Pango::WEIGHT_BOLD);
@ -351,7 +351,7 @@ void CropWindow::buttonPress (int button, int type, int bstate, int x, int y)
if ((bstate & GDK_SHIFT_MASK) && cropHandler.cropParams.w > 0 && cropHandler.cropParams.h > 0) { if ((bstate & GDK_SHIFT_MASK) && cropHandler.cropParams.w > 0 && cropHandler.cropParams.h > 0) {
crop_custom_ratio = float(cropHandler.cropParams.w) / float(cropHandler.cropParams.h); crop_custom_ratio = float(cropHandler.cropParams.w) / float(cropHandler.cropParams.h);
} }
if (iarea->getToolMode () == TMColorPicker) { if (iarea->getToolMode () == TMColorPicker) {
if (hoveredPicker) { if (hoveredPicker) {
if ((bstate & GDK_CONTROL_MASK) && !(bstate & GDK_SHIFT_MASK)) { if ((bstate & GDK_CONTROL_MASK) && !(bstate & GDK_SHIFT_MASK)) {
@ -1385,7 +1385,7 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr)
} }
} }
bool useBgColor = (state == SNormal || state == SDragPicker || state == SDeletePicker || state == SEditDrag1); bool useBgColor = (state == SNormal || state == SDragPicker || state == SDeletePicker || state == SEditDrag1);
if (cropHandler.cropPixbuf) { if (cropHandler.cropPixbuf) {
imgW = cropHandler.cropPixbuf->get_width (); imgW = cropHandler.cropPixbuf->get_width ();
imgH = cropHandler.cropPixbuf->get_height (); imgH = cropHandler.cropPixbuf->get_height ();
@ -1653,7 +1653,7 @@ void CropWindow::expose (Cairo::RefPtr<Cairo::Context> cr)
const int shThreshold = options.shadowThreshold; const int shThreshold = options.shadowThreshold;
const float ShawdowFac = 64.f / (options.shadowThreshold + 1); const float ShawdowFac = 64.f / (options.shadowThreshold + 1);
const float HighlightFac = 64.f / (256 - options.highlightThreshold); const float HighlightFac = 64.f / (256 - options.highlightThreshold);
const bool showclippedAny = (!showR && !showG && !showB && !showL); // will show clipping if any (all) of RGB chanels is (shadow) clipped const bool showclippedAny = (!showR && !showG && !showB && !showL); // will show clipping if any (all) of RGB channels is (shadow) clipped
#ifdef _OPENMP #ifdef _OPENMP
#pragma omp parallel for schedule(dynamic,16) #pragma omp parallel for schedule(dynamic,16)

View File

@ -1131,7 +1131,7 @@ void ICCProfileCreator::savePressed()
//calculate XYZ matrix for each primaries and each temp (D50, D65...) //calculate XYZ matrix for each primaries and each temp (D50, D65...)
// reduce coordonate of primaries // reduce coordinate of primaries
//printf("p0=%f p1=%f p2=%f p3=%f p4=%f p5=%f \n", p[0], p[1], p[2], p[3],p[4], p[5]); //printf("p0=%f p1=%f p2=%f p3=%f p4=%f p5=%f \n", p[0], p[1], p[2], p[3],p[4], p[5]);
double Xr = p[0] / p[1]; double Xr = p[0] / p[1];
double Yr = 1.0; double Yr = 1.0;