Maven module :un.api : api-image :
Class : un.impl.image.process.detection.CannyOperator
Extends/Implements : un.api.task.AbstractTask
Subclasses : -


This software has been released into the public domain.
Please read the notes in this source file for additional information.




This class provides a configurable implementation of the Canny edge detection
algorithm. This classic algorithm has a number of shortcomings, but remains
an effective tool in many scenarios. This class is designed for single
threaded use only.






For a more complete understanding of this edge detector's parameters consult
an explanation of the algorithm.



TODO : resuse gaussian operator

Origin :
http://www.tomgibara.com/computer-vision/CannyEdgeDetector.java

@author Tom Gibara (Original author)
@author Johann Sorel (Adapted to Unlicense-Lib)


Variables : INPUT_LOWER_THRESHOLD, INPUT_HIGHER_THRESHOLD, INPUT_GAUSSIAN_KERNEL_RADIUS, INPUT_GAUSSIAN_KERNEL_WIDTH, INPUT_CONTRAST_NORMALIZED, DESCRIPTOR
Functions : CannyOperator, getSourceImage, setSourceImage, getEdgesImage, setEdgesImage, getLowThreshold, setLowThreshold, getHighThreshold, setHighThreshold, getGaussianKernelWidth, setGaussianKernelWidth, getGaussianKernelRadius, setGaussianKernelRadius, isContrastNormalized, setContrastNormalized, execute


public ParameterValueType INPUT_LOWER_THRESHOLD

public ParameterValueType INPUT_HIGHER_THRESHOLD

public ParameterValueType INPUT_GAUSSIAN_KERNEL_RADIUS

public ParameterValueType INPUT_GAUSSIAN_KERNEL_WIDTH

public ParameterValueType INPUT_CONTRAST_NORMALIZED

public DefaultImageTaskDescriptor DESCRIPTOR



Constructs a new detector with default parameters.
public void CannyOperator ()


The image that provides the luminance data used by this detector to
generate edges.
return  the source image, or null
public Image getSourceImage ()


Specifies the image that will provide the luminance data in which edges
will be detected. A source image must be set before the process method is
called.
param  image a source of luminance data
public void setSourceImage (Image image)


Obtains an image containing the edges detected during the last call to
the process method. The buffered image is an opaque image of type
BufferedImage.TYPE_INT_ARGB in which edge pixels are white and all other
pixels are black.
return  an image containing the detected edges, or null if the process
method has not yet been called.
public Image getEdgesImage ()


Sets the edges image. Calling this method will not change the operation
of the edge detector in any way. It is intended to provide a means by
which the memory referenced by the detector object may be reduced.
param  edgesImage expected (though not required) to be null
public void setEdgesImage (Image edgesImage)


The low threshold for hysteresis. The default value is 2.5.
return  the low hysteresis threshold
public float getLowThreshold ()


Sets the low threshold for hysteresis. Suitable values for this parameter
must be determined experimentally for each application. It is nonsensical
(though not prohibited) for this value to exceed the high threshold
value.

@param threshold a low hysteresis threshold
public void setLowThreshold (float threshold)


The high threshold for hysteresis. The default value is 7.5.
return  the high hysteresis threshold
public float getHighThreshold ()


Sets the high threshold for hysteresis. Suitable values for this
parameter must be determined experimentally for each application. It is
nonsensical (though not prohibited) for this value to be less than the
low threshold value.
param  threshold a high hysteresis threshold
public void setHighThreshold (float threshold)


The number of pixels across which the Gaussian kernel is applied. The
default value is 16.
return  the radius of the convolution operation in pixels
public int getGaussianKernelWidth ()


The number of pixels across which the Gaussian kernel is applied. This
implementation will reduce the radius if the contribution of pixel values
is deemed negligable, so this is actually a maximum radius.
param  gaussianKernelWidth a radius for the convolution operation in
pixels, at least 2.
public void setGaussianKernelWidth (int gaussianKernelWidth)


The radius of the Gaussian convolution kernel used to smooth the source
image prior to gradient calculation. The default value is 16.
return  the Gaussian kernel radius in pixels
public float getGaussianKernelRadius ()


Sets the radius of the Gaussian convolution kernel used to smooth the
source image prior to gradient calculation.
return  a Gaussian kernel radius in pixels, must exceed 0.1f.
public void setGaussianKernelRadius (float gaussianKernelRadius)


Whether the luminance data extracted from the source image is normalized
by linearizing its histogram prior to edge extraction. The default value
is false.
return  whether the contrast is normalized
public boolean isContrastNormalized ()


Sets whether the contrast is normalized
param  contrastNormalized true if the contrast should be normalized,
false otherwise
public void setContrastNormalized (boolean contrastNormalized)

public Parameters execute ()