public class LocalShiftFinder
extends java.lang.Object
Like the images f and g, the components of displacement are sampled functions of coordinates x1 and x2. That is, displacements may vary from sample to sample. The components u1 and u2 represent displacements in the x1 and x2 coordinate directions, respectively.
This shift finder estimates each component of displacement using local cross-correlations. For each image sample, the estimated shift is that which yields the maximum correlation coefficient. This coefficient is found by quadratic interpolation of correlation functions sampled at integer lags.
The peak (maximum) correlation coefficient may be used to measure quality of an estimated shift. However, because a correlation function may have more than one peak (local maxima), a better measure of quality may be the difference between the coefficients for the correlation peak and next highest peak. Both the peak coefficient and this difference may be computed with the shifts.
Methods are provided to find and compensate for each component of shift sequentially. As each component is found, that component can be removed from the image g before estimating another component. For example, again for 2-D images f(x1,x2) and g(x1,x2), we might first estimate u1(x1,x2). If we then compute an image h(x1,x2) = g(x1+u1(x1,x2),x2), we can use f(x1,x2) and h(x1,x2) to estimate u2(x1,x2). By repeating this process sequentially, we obtain estimates for both u1(x1,x2) and u2(x1,x2) such that f(x1,x2) ~ g(x1+u1(x1,x2),x2+u2(x1,x2)).
Methods are also provided to whiten 2-D and 3-D images before estimating displacement vectors. This (spectral) whitening improves estimates of displacements parallel to image features that may be otherwise poorly resolved. Whitening is performed with local prediction error filters computed from local auto-correlations.
Constructor and Description |
---|
LocalShiftFinder(double sigma)
Construct a shift estimator with specified parameters.
|
LocalShiftFinder(double sigma1,
double sigma2)
Construct a shift estimator with specified parameters.
|
LocalShiftFinder(double sigma1,
double sigma2,
double sigma3)
Construct a shift estimator with specified parameters.
|
Modifier and Type | Method and Description |
---|---|
void |
find1(int min1,
int max1,
float[][][] f,
float[][][] g,
float[][][] u)
Finds shifts in the 1st dimension.
|
void |
find1(int min1,
int max1,
float[][] f,
float[][] g,
float[][] u)
Finds shifts in the 1st dimension.
|
void |
find1(int min1,
int max1,
float[] f,
float[] g,
float[] u)
Finds shifts in the 1st (and only) dimension.
|
void |
find1(int min1,
int max1,
float[] f,
float[] g,
float[] u,
float[] c,
float[] d)
Finds shifts in the 1st (and only) dimension.
|
void |
find2(int min2,
int max2,
float[][][] f,
float[][][] g,
float[][][] u)
Finds shifts in the 2nd dimension.
|
void |
find2(int min2,
int max2,
float[][] f,
float[][] g,
float[][] u)
Finds shifts in the 2nd dimension.
|
void |
find3(int min3,
int max3,
float[][][] f,
float[][][] g,
float[][][] u)
Finds shifts in the 3rd dimension.
|
void |
setInterpolateDisplacements(boolean enable)
Enables or disables interpolation of displacements when shifting.
|
void |
shift1(float[][][] du,
float[][][] u1,
float[][][] u2,
float[][][] u3,
float[][][] h)
Applies specified shift in the 1st dimension.
|
void |
shift1(float[][] du,
float[][] u1,
float[][] u2,
float[][] h)
Applies specified shift in the 1st dimension.
|
void |
shift1(float[] du,
float[] u1,
float[] h)
Applies specified shift in the 1st (and only) dimension.
|
void |
shift2(float[][][] du,
float[][][] u1,
float[][][] u2,
float[][][] u3,
float[][][] h)
Applies specified shift in the 2nd dimension.
|
void |
shift2(float[][] du,
float[][] u1,
float[][] u2,
float[][] h)
Applies specified shift in the 2nd dimension.
|
void |
shift3(float[][][] du,
float[][][] u1,
float[][][] u2,
float[][][] u3,
float[][][] h)
Applies specified shift in the 3rd dimension.
|
void |
whiten(double sigma,
float[][][] f,
float[][][] g)
Applies local prediction-error (spectal whitening) filters.
|
void |
whiten(double sigma,
float[][] f,
float[][] g)
Applies local prediction-error (spectal whitening) filters.
|
void |
whiten(float[][][] f,
float[][][] g)
Applies local prediction-error (spectal whitening) filters.
|
void |
whiten(float[][] f,
float[][] g)
Applies local prediction-error (spectal whitening) filters.
|
public LocalShiftFinder(double sigma)
sigma
- the correlation window half-width; must not be less than 1.public LocalShiftFinder(double sigma1, double sigma2)
sigma1
- correlaton window half-width for 0st dimension;
must not be less than 1.sigma2
- correlation window half-width for 2nd and higher
dimensions; must not be less than 1.public LocalShiftFinder(double sigma1, double sigma2, double sigma3)
sigma1
- correlation window half-width for 1st dimension;
must not be less than 1.sigma2
- correlation window half-width for 2nd dimension;
must not be less than 1.sigma3
- correlation window half-width for 3rd and higher
dimensions; must not be less than 1.public void setInterpolateDisplacements(boolean enable)
enable
- true, to enable interpolation; false, to disable.public void find1(int min1, int max1, float[] f, float[] g, float[] u)
min1
- the minimum shift.max1
- the maximum shift.f
- the input array f.g
- the input array g.u
- output array of shifts.public void find1(int min1, int max1, float[] f, float[] g, float[] u, float[] c, float[] d)
min1
- the minimum shift.max1
- the maximum shift.f
- the input array f.g
- the input array g.u
- output array of shifts.c
- output array of peak correlation coefficients.d
- output array of differences, peak minus next-highest-peak.public void find1(int min1, int max1, float[][] f, float[][] g, float[][] u)
min1
- the minimum shift.max1
- the maximum shift.f
- the input array f.g
- the input array g.u
- output array of shifts.public void find2(int min2, int max2, float[][] f, float[][] g, float[][] u)
min2
- the minimum shift.max2
- the maximum shift.f
- the input array f.g
- the input array g.u
- output array of shifts.public void find1(int min1, int max1, float[][][] f, float[][][] g, float[][][] u)
min1
- the minimum shift.max1
- the maximum shift.f
- the input array f.g
- the input array g.u
- output array of shifts.public void find2(int min2, int max2, float[][][] f, float[][][] g, float[][][] u)
min2
- the minimum shift.max2
- the maximum shift.f
- the input array f.g
- the input array g.u
- output array of shifts.public void find3(int min3, int max3, float[][][] f, float[][][] g, float[][][] u)
min3
- the minimum shift.max3
- the maximum shift.f
- the input array f.g
- the input array g.u
- output array of shifts.public void shift1(float[] du, float[] u1, float[] h)
du
- input array of changes to displacements in 1st dimension.u1
- input/output array of displacements in 1st dimension.h
- input/output array of image samples.public void shift1(float[][] du, float[][] u1, float[][] u2, float[][] h)
du
- input array of changes to displacements in 1st dimension.u1
- input/output array of displacements in 1st dimension.u2
- input/output array of displacements in 2nd dimension.h
- input/output array of image samples.public void shift2(float[][] du, float[][] u1, float[][] u2, float[][] h)
du
- input array of changes to displacements in 2nd dimension.u1
- input/output array of displacements in 1st dimension.u2
- input/output array of displacements in 2nd dimension.h
- input/output array of image samples.public void shift1(float[][][] du, float[][][] u1, float[][][] u2, float[][][] u3, float[][][] h)
du
- input array of changes to displacements in 1st dimension.u1
- input/output array of displacements in 1st dimension.u2
- input/output array of displacements in 2nd dimension.u3
- input/output array of displacements in 3rd dimension.h
- input/output array of image samples.public void shift2(float[][][] du, float[][][] u1, float[][][] u2, float[][][] u3, float[][][] h)
du
- input array of changes to displacements in 2nd dimension.u1
- input/output array of displacements in 1st dimension.u2
- input/output array of displacements in 2nd dimension.u3
- input/output array of displacements in 3rd dimension.h
- input/output array of image samples.public void shift3(float[][][] du, float[][][] u1, float[][][] u2, float[][][] u3, float[][][] h)
du
- input array of changes to displacements in 3rd dimension.u1
- input/output array of displacements in 1st dimension.u2
- input/output array of displacements in 2nd dimension.u3
- input/output array of displacements in 3rd dimension.h
- input/output array of image samples.public void whiten(float[][] f, float[][] g)
f
- the input array.g
- the output array.public void whiten(double sigma, float[][] f, float[][] g)
sigma
- half-width of Gaussian smoothing applied after whitening;
less than one for no smoothing.f
- the input array.g
- the output array.public void whiten(float[][][] f, float[][][] g)
f
- the input array.g
- the output array.public void whiten(double sigma, float[][][] f, float[][][] g)
sigma
- half-width of Gaussian smoothing applied after whitening;
less than one for no smoothing.f
- the input array.g
- the output array.