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.

The filter accepts 8 bpp grayscale images for processing.

Sample usage:

// create filter CannyEdgeDetector filter = new CannyEdgeDetector( ); // apply the filter filter.ApplyInPlace( image );

Initial image:

Result image:

Inheritance: BaseUsingCopyPartialFilter
Example #1
0
        private void SetFilter()
        {
            ImageType = ImageTypes.GrayscaleBT709;
            Af.CannyEdgeDetector newFilter = new Af.CannyEdgeDetector();
            newFilter.GaussianSigma = sigma;
            newFilter.GaussianSize  = size;
            newFilter.LowThreshold  = (byte)lowThreshold;
            newFilter.HighThreshold = (byte)highThreshold;

            imageFilter = newFilter;
        }