public class CannyEdgeDetector extends java.lang.Object implements IApplyInPlace
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.
| 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.
|
| Modifier and Type | Method and Description |
|---|---|
void |
applyInPlace(FastBitmap fastBitmap)
Apply filter to an image.
|
int |
getHighThreshold()
Get High threshold.
|
int |
getLowThreshold()
Get Low threshold.
|
double |
getSigma()
Get Gaussian sigma.
|
int |
getSize()
Get Gaussian kernel size.
|
void |
setHighThreshold(int highThreshold)
Set High threshold.
|
void |
setLowThreshold(int lowThreshold)
Set Low threshold.
|
void |
setSigma(double sigma)
Set Gaussian sigma.
|
void |
setSize(int size)
Set Gaussian kernel size.
|
public CannyEdgeDetector()
public CannyEdgeDetector(int lowThreshold,
int highThreshold)
lowThreshold - Low threshold. (Used for hysteresis).highThreshold - High Threshold. (Used for hysteresis).public CannyEdgeDetector(int lowThreshold,
int highThreshold,
double sigma)
lowThreshold - Low threshold. (Used for hysteresis).highThreshold - High Threshold. (Used for hysteresis).sigma - Gaussian sigma.public CannyEdgeDetector(int lowThreshold,
int highThreshold,
double sigma,
int size)
lowThreshold - Low threshold. (Used for hysteresis).highThreshold - High Threshold. (Used for hysteresis).sigma - Gaussian sigma.size - Size of gaussian kernel.public int getLowThreshold()
public void setLowThreshold(int lowThreshold)
lowThreshold - Threshold value.public int getHighThreshold()
public void setHighThreshold(int highThreshold)
highThreshold - Threshold value.public double getSigma()
public void setSigma(double sigma)
sigma - Gaussian sigma.public int getSize()
public void setSize(int size)
size - Gaussian kernel size.public void applyInPlace(FastBitmap fastBitmap)
IApplyInPlaceapplyInPlace in interface IApplyInPlacefastBitmap - Image to be processed.