Class CannyEdgeDetector
- java.lang.Object
-
- Catalano.Imaging.Filters.CannyEdgeDetector
-
- All Implemented Interfaces:
- IApplyInPlace
public class CannyEdgeDetector extends java.lang.Object implements IApplyInPlace
Canny edge detector. The filter searches for objects' edges by applying Canny edge detector. The implementation follows Bill Green's Canny edge detection tutorial.The implemented canny edge detector has one difference with the above linked algorithm. The difference is in hysteresis step, which is a bit simplified (getting faster as a result). On the hysteresis step each pixel is compared with two threshold values: HighThreshold and LowThreshold. If pixel's value is greater or equal to HighThreshold, then it is kept as edge pixel. If pixel's value is greater or equal to LowThreshold, then it is kept as edge pixel only if there is at least one neighbouring pixel (8 neighbours are checked) which has value greater or equal to HighThreshold; otherwise it is none edge pixel. In the case if pixel's value is less than LowThreshold, then it is marked as none edge immediately.
- Supported types: Grayscale.
- Coordinate System: Matrix.
-
-
Constructor Summary
Constructors Constructor and Description CannyEdgeDetector()Initialize a new instance of the CannyEdgeDetector class.CannyEdgeDetector(int lowThreshold, int highThreshold)Initialize a new instance of the CannyEdgeDetector class.CannyEdgeDetector(int lowThreshold, int highThreshold, double sigma)Initialize a new instance of the CannyEdgeDetector class.CannyEdgeDetector(int lowThreshold, int highThreshold, double sigma, int size)Initialize a new instance of the CannyEdgeDetector class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method and Description voidapplyInPlace(FastBitmap fastBitmap)Apply filter to an image.intgetHighThreshold()Get High threshold.intgetLowThreshold()Get Low threshold.doublegetSigma()Get Gaussian sigma.intgetSize()Get Gaussian kernel size.voidsetHighThreshold(int highThreshold)Set High threshold.voidsetLowThreshold(int lowThreshold)Set Low threshold.voidsetSigma(double sigma)Set Gaussian sigma.voidsetSize(int size)Set Gaussian kernel size.
-
-
-
Constructor Detail
-
CannyEdgeDetector
public CannyEdgeDetector()
Initialize a new instance of the CannyEdgeDetector class.
-
CannyEdgeDetector
public CannyEdgeDetector(int lowThreshold, int highThreshold)Initialize a new instance of the CannyEdgeDetector class.- Parameters:
lowThreshold- Low threshold. (Used for hysteresis).highThreshold- High Threshold. (Used for hysteresis).
-
CannyEdgeDetector
public CannyEdgeDetector(int lowThreshold, int highThreshold, double sigma)Initialize a new instance of the CannyEdgeDetector class.- Parameters:
lowThreshold- Low threshold. (Used for hysteresis).highThreshold- High Threshold. (Used for hysteresis).sigma- Gaussian sigma.
-
CannyEdgeDetector
public CannyEdgeDetector(int lowThreshold, int highThreshold, double sigma, int size)Initialize a new instance of the CannyEdgeDetector class.- Parameters:
lowThreshold- Low threshold. (Used for hysteresis).highThreshold- High Threshold. (Used for hysteresis).sigma- Gaussian sigma.size- Size of gaussian kernel.
-
-
Method Detail
-
getLowThreshold
public int getLowThreshold()
Get Low threshold. Used for Hysteresis.- Returns:
- Low threshold.
-
setLowThreshold
public void setLowThreshold(int lowThreshold)
Set Low threshold.- Parameters:
lowThreshold- Threshold value.
-
getHighThreshold
public int getHighThreshold()
Get High threshold. Used for Hysteresis.- Returns:
- Threshold value.
-
setHighThreshold
public void setHighThreshold(int highThreshold)
Set High threshold.- Parameters:
highThreshold- Threshold value.
-
getSigma
public double getSigma()
Get Gaussian sigma.- Returns:
- Gaussian sigma.
-
setSigma
public void setSigma(double sigma)
Set Gaussian sigma.- Parameters:
sigma- Gaussian sigma.
-
getSize
public int getSize()
Get Gaussian kernel size.- Returns:
- Gaussian kernel size.
-
setSize
public void setSize(int size)
Set Gaussian kernel size.- Parameters:
size- Gaussian kernel size.
-
applyInPlace
public void applyInPlace(FastBitmap fastBitmap)
Description copied from interface:IApplyInPlaceApply filter to an image.- Specified by:
applyInPlacein interfaceIApplyInPlace- Parameters:
fastBitmap- Image to be processed.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG