com.pearsoneduc.ip.op
Class CannyEdgeOp
java.lang.Object
|
+--com.pearsoneduc.ip.op.StandardGreyOp
|
+--com.pearsoneduc.ip.op.CannyEdgeOp
- public class CannyEdgeOp
- extends StandardGreyOp
Performs Canny edge detection on an image.
- Version:
- 1.0 [1999/07/30]
- Author:
- Nick Efford
Constructor Summary |
CannyEdgeOp(float size)
Creates a CannyEdgeOp with the specified Gaussian filter size. |
CannyEdgeOp(float size,
int low,
int high)
Creates a CannyEdgeOp with the specified Gaussian filter size
and a pair of thresholds. |
CannyEdgeOp(float size,
int low,
int high,
int calcMethod)
Creates a CannyEdgeOp with the specified Gaussian filter size,
thresholds and gradient magnitude calculation method. |
Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
SQRT_MAGNITUDES
public static final int SQRT_MAGNITUDES
ABS_MAGNITUDES
public static final int ABS_MAGNITUDES
CannyEdgeOp
public CannyEdgeOp(float size)
- Creates a CannyEdgeOp with the specified Gaussian filter size.
Gradient data will not be thresholded.
- Parameters:
size
- standard deviation of Gaussian
CannyEdgeOp
public CannyEdgeOp(float size,
int low,
int high)
- Creates a CannyEdgeOp with the specified Gaussian filter size
and a pair of thresholds. If the thresholds are equal, ordinary
thresholding of gradient data takes place; if they differ,
hysteresis thresholding is used.
- Parameters:
size
- standard deviation of Gaussianlow
- lower thresholdhigh
- upper threshold
CannyEdgeOp
public CannyEdgeOp(float size,
int low,
int high,
int calcMethod)
- Creates a CannyEdgeOp with the specified Gaussian filter size,
thresholds and gradient magnitude calculation method. If the
thresholds are equal, ordinary thresholding of gradient magnitude
takes place; if they differ, hysteresis thresholding is used.
- Parameters:
size
- standard deviation of Gaussianlow
- lower thresholdhigh
- upper thresholdcalcMethod
- calculation method
getFilterSize
public float getFilterSize()
- Returns:
- size of Gaussian low pass filter used for smoothing.
getLowThreshold
public int getLowThreshold()
- Returns:
- lower threshold applied to gradient magnitudes.
getHighThreshold
public int getHighThreshold()
- Returns:
- upper threshold applied to gradient magnitudes.
getMagnitudeCalculationMethod
public int getMagnitudeCalculationMethod()
- Returns:
- gradient magnitude calculation method.
getGradientMagnitudeImage
public java.awt.image.BufferedImage getGradientMagnitudeImage()
- Returns:
- gradient magnitude image generated by last call to
the filter() method.
getGradientOrientationImage
public java.awt.image.BufferedImage getGradientOrientationImage()
- Returns:
- gradient orientation image generated by last call
to the filter() method.
filter
public java.awt.image.BufferedImage filter(java.awt.image.BufferedImage src,
java.awt.image.BufferedImage dest)
- Performs Canny edge detection on an image.
- Parameters:
src
- source imagedest
- destination image, or null- Returns:
- edge map or gradient magnitudes
- Overrides:
- filter in class StandardGreyOp
computeGradient
protected void computeGradient(java.awt.image.BufferedImage image)
- Computes gradient magnitude and orientation in the specified image.
- Parameters:
image
- source image
performNonMaximalSuppression
protected void performNonMaximalSuppression()
- Peforms non-maximal suppression of gradient magnitude data.
applyHighThreshold
protected void applyHighThreshold(java.awt.image.BufferedImage image)
- Generates an edge map by applying a single threshold to
gradient magnitude data.
- Parameters:
image
- destination image
performHysteresisThresholding
protected void performHysteresisThresholding(java.awt.image.BufferedImage image)
- Generates an edge map by hysteresis thresholding.
- Parameters:
image
- destination image
trace
protected boolean trace(int x,
int y,
java.awt.image.WritableRaster raster)
- Recursively tracks edges between strong edge pixels.
- Parameters:
x
- x coordinate of starting pointy
- y coordinate of starting pointraster
- edge map