public class GradientSobel
extends java.lang.Object
Computes the image's first derivative along the x and y axises using the Sobel operator.
The Sobel kernel weights the inner most pixels more than ones farther away. This tends to produce better results, but not as good as a gaussian kernel with larger kernel. However, it can be optimized so that it is much faster than a Gaussian.
For integer images, the derivatives in the x and y direction are computed by convolving the following kernels:
y-axis
| -0.25 | -0.5 | -0.25 |
| 0 | 0 | 0 |
| 0.25 | 0.5 | 0.25 |
| -1 | 0 | 1 |
| -2 | 0 | 2 |
| -1 | 0 | 1 |
| Modifier and Type | Field and Description |
|---|---|
static Kernel2D_F32 |
kernelDerivX_F32 |
static Kernel2D_I32 |
kernelDerivX_I32 |
static Kernel2D_F32 |
kernelDerivY_F32 |
static Kernel2D_I32 |
kernelDerivY_I32 |
| Constructor and Description |
|---|
GradientSobel() |
| Modifier and Type | Method and Description |
|---|---|
static Kernel2D |
getKernelX(boolean isInteger)
Returns the kernel for computing the derivative along the x-axis.
|
static void |
process(ImageFloat32 orig,
ImageFloat32 derivX,
ImageFloat32 derivY,
ImageBorder_F32 border)
Computes the derivative in the X and Y direction using an integer Sobel edge detector.
|
static void |
process(ImageSInt16 orig,
ImageSInt16 derivX,
ImageSInt16 derivY,
ImageBorder_S32<ImageSInt16> border)
Computes the derivative in the X and Y direction using an integer Sobel edge detector.
|
static void |
process(ImageUInt8 orig,
ImageSInt16 derivX,
ImageSInt16 derivY,
ImageBorder_S32<ImageUInt8> border)
Computes the derivative in the X and Y direction using an integer Sobel edge detector.
|
public static Kernel2D_I32 kernelDerivX_I32
public static Kernel2D_I32 kernelDerivY_I32
public static Kernel2D_F32 kernelDerivX_F32
public static Kernel2D_F32 kernelDerivY_F32
public static Kernel2D getKernelX(boolean isInteger)
public static void process(ImageUInt8 orig, ImageSInt16 derivX, ImageSInt16 derivY, ImageBorder_S32<ImageUInt8> border)
orig - Input image. Not modified.derivX - Storage for image derivative along the x-axis. Modified.derivY - Storage for image derivative along the y-axis. Modified.border - Specifies how the image border is handled. If null the border is not processed.public static void process(ImageSInt16 orig, ImageSInt16 derivX, ImageSInt16 derivY, ImageBorder_S32<ImageSInt16> border)
orig - Input image. Not modified.derivX - Storage for image derivative along the x-axis. Modified.derivY - Storage for image derivative along the y-axis. Modified.border - Specifies how the image border is handled. If null the border is not processed.public static void process(ImageFloat32 orig, ImageFloat32 derivX, ImageFloat32 derivY, ImageBorder_F32 border)
orig - Input image. Not modified.derivX - Storage for image derivative along the x-axis. Modified.derivY - Storage for image derivative along the y-axis. Modified.border - Specifies how the image border is handled. If null the border is not processed.