Packages

c

canny

CannyEdgeDetector

class CannyEdgeDetector extends AnyRef

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.

Sample usage:


//create the detector
CannyEdgeDetector detector = new CannyEdgeDetector();
//adjust its parameters as desired
detector.setLowThreshold(0.5f);
detector.setHighThreshold(1f);
//apply it to an image
detector.setSourceImage(frame);
detector.process();
BufferedImage edges = detector.getEdgesImage();

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

Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. CannyEdgeDetector
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. All

Instance Constructors

  1. new CannyEdgeDetector()

Value Members

  1. final def !=(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  2. final def ##(): Int
    Definition Classes
    AnyRef → Any
  3. final def ==(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  4. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: Any): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  9. final def getClass(): Class[_]
    Definition Classes
    AnyRef → Any
  10. def getEdgesImage(): BufferedImage

    Obtains an image containing the edges detected during the last call to the process method.

    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.

    returns

    an image containing the detected edges, or null if the process method has not yet been called.

  11. def getGaussianKernelRadius(): Float

    The radius of the Gaussian convolution kernel used to smooth the source image prior to gradient calculation.

    The radius of the Gaussian convolution kernel used to smooth the source image prior to gradient calculation. The default value is 16.

    returns

    the Gaussian kernel radius in pixels

  12. def getGaussianKernelWidth(): Int

    The number of pixels across which the Gaussian kernel is applied.

    The number of pixels across which the Gaussian kernel is applied. The default value is 16.

    returns

    the radius of the convolution operation in pixels

  13. def getHighThreshold(): Float

    The high threshold for hysteresis.

    The high threshold for hysteresis. The default value is 7.5.

    returns

    the high hysteresis threshold

  14. def getLowThreshold(): Float

    The low threshold for hysteresis.

    The low threshold for hysteresis. The default value is 2.5.

    returns

    the low hysteresis threshold

  15. def getSourceImage(): BufferedImage

    The image that provides the luminance data used by this detector to generate edges.

    The image that provides the luminance data used by this detector to generate edges.

    returns

    the source image, or null

  16. def hashCode(): Int
    Definition Classes
    AnyRef → Any
  17. def isContrastNormalized(): Boolean

    Whether the luminance data extracted from the source image is normalized by linearizing its histogram prior to edge extraction.

    Whether the luminance data extracted from the source image is normalized by linearizing its histogram prior to edge extraction. The default value is false.

    returns

    whether the contrast is normalized

  18. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  19. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  20. final def notify(): Unit
    Definition Classes
    AnyRef
  21. final def notifyAll(): Unit
    Definition Classes
    AnyRef
  22. def process(): Unit
  23. def setContrastNormalized(contrastNormalized: Boolean): Unit

    Sets whether the contrast is normalized

    Sets whether the contrast is normalized

    contrastNormalized

    true if the contrast should be normalized, false otherwise

  24. def setEdgesImage(edgesImage: BufferedImage): Unit

    Sets the edges image.

    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.

    edgesImage

    expected (though not required) to be null

  25. def setGaussianKernelRadius(gaussianKernelRadius: Float): Unit

    Sets the radius of the Gaussian convolution kernel used to smooth the source image prior to gradient calculation.

    Sets the radius of the Gaussian convolution kernel used to smooth the source image prior to gradient calculation.

    returns

    a Gaussian kernel radius in pixels, must exceed 0.1f.

  26. def setGaussianKernelWidth(gaussianKernelWidth: Int): Unit

    The number of pixels across which the Gaussian kernel is applied.

    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.

    gaussianKernelWidth

    a radius for the convolution operation in pixels, at least 2.

  27. def setHighThreshold(threshold: Float): Unit

    Sets the high threshold for hysteresis.

    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.

    threshold

    a high hysteresis threshold

  28. def setLowThreshold(threshold: Float): Unit

    Sets the low threshold for hysteresis.

    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.

    threshold

    a low hysteresis threshold

  29. def setSourceImage(image: BufferedImage): Unit

    Specifies the image that will provide the luminance data in which edges will be detected.

    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.

    image

    a source of luminance data

  30. final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
    AnyRef
  31. def toString(): String
    Definition Classes
    AnyRef → Any
  32. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  33. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  34. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )

Inherited from AnyRef

Inherited from Any

Ungrouped