public class LocalDiffusionKernel
extends java.lang.Object
This kernel is a filter that computes y += G'DGx where G is a gradient operator, G' is its adjoint, and D is a local diffusion tensor field that determines for each image sample the filter coefficients.
A local diffusion kernel is typically used in combinations with others. For example, the filter implied by (I+G'DG)y = G'DGx acts as a notch filter. It attenuates features for which G'DG is zero while preserving other features. The diffusion tensors in D control the width, orientation, and anisotropy of the spectral notch. Note that application of this filter requires solution of a sparse symmetric positive-definite system of equations.
An even simpler example is the filter implied by (I+G'DG)y = x. This filter smooths features in the directions implied by the tensors D. Again, application of this filter requires solving a sparse symmetric positive-definite system of equations.
The accumulation of the kernel output in y = y+G'DGx is useful when constructing such filter combinations. Given y = 0, this kernel computes y = G'DGx. Given y = x, it computes y = (I+G'DG)x.
Modifier and Type | Class and Description |
---|---|
static class |
LocalDiffusionKernel.Stencil
The stencil used in finite-difference approximation of derivatives.
|
Constructor and Description |
---|
LocalDiffusionKernel()
Constructs a local diffusion kernel with default 2x2 stencil.
|
LocalDiffusionKernel(LocalDiffusionKernel.Stencil s)
Constructs a local diffusion kernel with specified stencil.
|
Modifier and Type | Method and Description |
---|---|
void |
apply(float[][][] x,
float[][][] y)
Applies this filter for a constant isotropic identity tensor.
|
void |
apply(float[][] x,
float[][] y)
Applies this filter for constant isotropic identity tensor.
|
void |
apply(float c,
float[][][] x,
float[][][] y)
Applies this filter for specified scale factor.
|
void |
apply(float c,
float[][][] s,
float[][][] x,
float[][][] y)
Applies this filter for specified scale factors.
|
void |
apply(float c,
float[][] x,
float[][] y)
Applies this filter for specified scale factor.
|
void |
apply(float c,
float[][] s,
float[][] x,
float[][] y)
Applies this filter for specified scale factors.
|
void |
apply(Tensors2 d,
float[][] x,
float[][] y)
Applies this filter for specified tensor coefficients.
|
void |
apply(Tensors2 d,
float c,
float[][] x,
float[][] y)
Applies this filter for specified tensor coefficients and scale factor.
|
void |
apply(Tensors2 d,
float c,
float[][] s,
float[][] x,
float[][] y)
Applies this filter for specified tensor coefficients and scale factors.
|
void |
apply(Tensors3 d,
float[][][] x,
float[][][] y)
Applies this filter for specified tensor coefficients.
|
void |
apply(Tensors3 d,
float c,
float[][][] x,
float[][][] y)
Applies this filter for specified tensor coefficients and scale factor.
|
void |
apply(Tensors3 d,
float c,
float[][][] s,
float[][][] x,
float[][][] y)
Applies this filter for specified tensor coefficients and scale factors.
|
LocalDiffusionKernel.Stencil |
getStencil()
Gets the stencil used by this local diffusion kernel.
|
static void |
main(java.lang.String[] args) |
void |
setNumberOfPasses(int npass)
Sets the number of kernel passes in each apply of this filter.
|
public LocalDiffusionKernel()
public LocalDiffusionKernel(LocalDiffusionKernel.Stencil s)
s
- the stencil used to approximate a derivative.public LocalDiffusionKernel.Stencil getStencil()
public void setNumberOfPasses(int npass)
public void apply(float[][] x, float[][] y)
x
- input array.y
- output array.public void apply(Tensors2 d, float[][] x, float[][] y)
d
- tensor coefficients.x
- input array.y
- output array.public void apply(float c, float[][] x, float[][] y)
c
- constant scale factor for tensor coefficients.x
- input array.y
- output array.public void apply(Tensors2 d, float c, float[][] x, float[][] y)
d
- tensor coefficients.c
- constant scale factor for tensor coefficients.x
- input array.y
- output array.public void apply(float c, float[][] s, float[][] x, float[][] y)
c
- constant scale factor for tensor coefficients.s
- array of scale factors for tensor coefficients.x
- input array.y
- output array.public void apply(Tensors2 d, float c, float[][] s, float[][] x, float[][] y)
d
- tensor coefficients.c
- constant scale factor for tensor coefficients.s
- array of scale factors for tensor coefficients.x
- input array.y
- output array.public void apply(float[][][] x, float[][][] y)
x
- input array.y
- output array.public void apply(Tensors3 d, float[][][] x, float[][][] y)
d
- tensor coefficients.x
- input array.y
- output array.public void apply(float c, float[][][] x, float[][][] y)
c
- constant scale factor for tensor coefficients.x
- input array.y
- output array.public void apply(Tensors3 d, float c, float[][][] x, float[][][] y)
d
- tensor coefficients.c
- constant scale factor for tensor coefficients.x
- input array.y
- output array.public void apply(float c, float[][][] s, float[][][] x, float[][][] y)
c
- constant scale factor for tensor coefficients.s
- array of scale factors for tensor coefficients.x
- input array.y
- output array.public void apply(Tensors3 d, float c, float[][][] s, float[][][] x, float[][][] y)
d
- tensor coefficients.c
- constant scale factor for tensor coefficients.s
- array of scale factors for tensor coefficients.x
- input array.y
- output array.public static void main(java.lang.String[] args)