Imp
[using it]
Interface Manipulation Package v4.0 (2008-06-25) a-projector ©copyright Author


imp.ima.util
Class Correl

java.lang.Object
  extended by imp.ima.util.Correl

public class Correl
extends Object

Implements the inter-correlation displacement field computation between two images.


Nested Class Summary
static class Correl.Displacement
          Defines a local displacement
 
Constructor Summary
Correl(int[] ima0, int[] ima1, int width, int height, int wsize, int hsize)
          Constructs a correlation operator between two images.
 
Method Summary
 double[] getAffine()
          Returns a least-square affine approximation of the displacement field.
 int getCorr(int ij0, int ij1)
          Gets the correlation error between two locations.
 Correl.Displacement getDisplacement(int ij0, int ij1)
          Gets the displacement between two locations.
 Correl.Displacement[] getDisplacements()
          Gets the displacement buffer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Correl

public Correl(int[] ima0,
              int[] ima1,
              int width,
              int height,
              int wsize,
              int hsize)
Constructs a correlation operator between two images.

Parameters:
ima0 - Left RGB buffer.
ima1 - Right RGB buffer.
width - Images width.
height - Images height.
wsize - Correlation window width.
hsize - [optional, default is wsize] Correlation window height.
Method Detail

getAffine

public double[] getAffine()
Returns a least-square affine approximation of the displacement field.

Returns:
The affine approximation coefficients a[6], with : (dx[i, j], dy[i, j]) = (a[0] + a[1] u + a[2] v, a[3] + a[4] u + a[5] v) and (u, v) = (i - width/2)/(width/2), (j - height/2)/(height/2) estimated in the least-square sense.

getCorr

public int getCorr(int ij0,
                   int ij1)
Gets the correlation error between two locations.

Parameters:
ij0 - Index ij0 = i0 + width * j0 of the location (i0, j0) in Image 0.
ij1 - Index ij1 = i1 + width * j1 of the location (i1, j1) in Image 1.
Returns:
The correlation error.

getDisplacement

public Correl.Displacement getDisplacement(int ij0,
                                           int ij1)
Gets the displacement between two locations.

Parameters:
ij0 - Index ij0 = i0 + width * j0 of the location (i0, j0) in Image 0.
ij1 - Index ij1 = i1 + width * j1 of the location (i1, j1) in Image 1.
Returns:
The displacement corresponding to the correlation minimal error.

getDisplacements

public Correl.Displacement[] getDisplacements()
Gets the displacement buffer.
A displacement field (dx[x,y], dy[x,y]) between two images minimizes the inter-correlation error between two images, computed in a rectangular [-wsize..wsize x -hsize..hsize] window:
.    _ wsize    _ hsize                                                      2
.    >          >       ||I0[x0+x,y0+y] - I1[x1+dx(x0,y0)+x,y1+dy(x0,y0)+y]||
.    - x=-wsize - y=-hsize
where ||ima[x,y]|| is the RGB standard norm.
Local minimization is performed iteratively looking for the correlation minimal error in a 3x3 neighborhood. Each displacement (dx, dy) is interpolated, in the least-square sense, fitting, in a 3x3 neighborhood, a quadric to the correlation surface:
  • for 2nd order points (i.e. corners, junctions, blobs, ..) this surface has a unique minimum in the 3x3 neighborhood corresponding to this displacement
  • for 1st order points (i.e. edges) this surface is cylindrical with a 1D infinity of minimal value and the displacement of minimal magnitude is chosen
  • else (i.e. for uniform or spurious area) a displacement of zero magnitude is returned.
The previous interpolation allows to estimate the least-square precision for each displacement.

Returns:
A [width x height] buffer with the displacement field.