com.pearsoneduc.ip.op
Class SobelEdgeOp

java.lang.Object
  |
  +--com.pearsoneduc.ip.op.StandardGreyOp
        |
        +--com.pearsoneduc.ip.op.SobelEdgeOp

public class SobelEdgeOp
extends StandardGreyOp

Performs edge detection using gradients computed with Sobel kernels. Gradient magnitude data are thresholded if a threshold was specified when creating the SobelEdgeOp.

Version:
1.0 [1999/07/23]
Author:
Nick Efford

Field Summary
static int ABS_MAGNITUDE
           
static int SQRT_MAGNITUDE
           
 
Constructor Summary
SobelEdgeOp()
          Constructs a SobelEdgeOp that computes gradient magnitudes without thresholding.
SobelEdgeOp(int threshold)
          Constructs a SobelEdgeOp that computes gradient magnitudes and performs thresholding to produce an edge map.
SobelEdgeOp(int threshold, int magCalc)
          Constructs a SobelEdgeOp that computes gradient magnitudes using the specified calculation method and then performs thresholding to produce an edge map.
 
Method Summary
 java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src, java.awt.image.BufferedImage dest)
          Computes gradient magnitude for an image using the Sobel kernels and optionally thresholds the data to produce an edge map.
 int getGradientThreshold()
           
 int getMagnitudeCalculation()
           
protected  float[] gradientMagnitude(java.awt.image.BufferedImage image)
          Computes gradient magnitudes for the specified image.
protected  int xGradient(java.awt.image.Raster raster, int x, int y)
          Computes the x component of the gradient vector at a given point in a raster.
protected  int yGradient(java.awt.image.Raster raster, int x, int y)
          Computes the y component of the gradient vector at a given point in a raster.
 
Methods inherited from class com.pearsoneduc.ip.op.StandardGreyOp
checkImage, createCompatibleDestImage, getBounds2D, getPoint2D, getRenderingHints
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

SQRT_MAGNITUDE

public static final int SQRT_MAGNITUDE

ABS_MAGNITUDE

public static final int ABS_MAGNITUDE
Constructor Detail

SobelEdgeOp

public SobelEdgeOp()
Constructs a SobelEdgeOp that computes gradient magnitudes without thresholding.

SobelEdgeOp

public SobelEdgeOp(int threshold)
Constructs a SobelEdgeOp that computes gradient magnitudes and performs thresholding to produce an edge map.
Parameters:
threshold - gradient magnitude threshold

SobelEdgeOp

public SobelEdgeOp(int threshold,
                   int magCalc)
Constructs a SobelEdgeOp that computes gradient magnitudes using the specified calculation method and then performs thresholding to produce an edge map.
Parameters:
threshold - gradient magnitude threshold
magCalc - gradient magnitude calculation method
Method Detail

getGradientThreshold

public int getGradientThreshold()
Returns:
current threshold on gradient magnitude.

getMagnitudeCalculation

public int getMagnitudeCalculation()
Returns:
gradient magnitude calculation method.

filter

public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src,
                                           java.awt.image.BufferedImage dest)
Computes gradient magnitude for an image using the Sobel kernels and optionally thresholds the data to produce an edge map.
Parameters:
src - source image
dest - destination image, or null
Returns:
processed image.
Overrides:
filter in class StandardGreyOp

gradientMagnitude

protected float[] gradientMagnitude(java.awt.image.BufferedImage image)
Computes gradient magnitudes for the specified image.
Parameters:
image - BufferedImage to be processed
Returns:
array of gradient magnitudes

xGradient

protected final int xGradient(java.awt.image.Raster raster,
                              int x,
                              int y)
Computes the x component of the gradient vector at a given point in a raster.
Parameters:
raster - pixel data
x - x coordinate of point under consideration
y - y coordinate of point under consideration
Returns:
gradient in the x direction.

yGradient

protected final int yGradient(java.awt.image.Raster raster,
                              int x,
                              int y)
Computes the y component of the gradient vector at a given point in a raster.
Parameters:
raster - pixel data
x - x coordinate of point under consideration
y - y coordinate of point under consideration
Returns:
gradient in the y direction.