Detecting and Enhancing Edges and Lines

The SharpenCommand class is designed specifically to emphasize the edges (shifts in intensity) in an image. It is a high-level method that can be used alone for the desired effect.

The SpatialFilterCommand class provides several predefined filters for detecting edges or lines. (It also lets you define your own filter.) These filters can be used alone in applications, such as industrial inspection systems, that analyze images. They can also be used to create an image that is combined with the original to change the appearance of lines or edges.

Choosing a predefined filter is a subjective, application-specific decision. The filters use standard algorithms, some of which have similar purposes. You may need to experiment with them to choose the appropriate filter for your application. The following is a summary of the available filters:

Filter

Purpose

Emboss

Creates an image with an embossed appearance. (This is used for artistic effect, but is listed here because it is one of the predefined filters.)

Gradient directional

Detects edges, starting from any of eight specified directions. All pixels not on the detected edges are changed to black.

Prewitt

Detects horizontal or vertical edges. All pixels not on the detected edges are changed to black.

Sobel

Detects horizontal or vertical edges. All pixels not on the detected edges are changed to black. (The usage is the same as Prewitt, but the algorithm is different.)

Shift-and-difference

Detects horizontal, vertical, or diagonal edges. All pixels not on the detected edges are changed to black.

Laplacian

Detects lines. There are three Omni directional filters and three bi-directional ones. All pixels not on the detected lines are changed to black.

Line-segment

Detects line segments. Possible directions are horizontal, vertical, left-to-right diagonal, and right-to-left diagonal. You can use this filter to find line discontinuities in an image. All pixels not on the detected line segments are changed to black.

To overcome the directional limitations of these filters, you can combine images that have been filtered in different ways. For example, you could make three copies of an image, filter each one with a different Laplacian directional filter, and use the CombineCommand class to create an image with all of the detected lines. You could then combine this resulting image with the original to enhance the lines in the original.

The EdgeDetectorCommand class can be used to apply a specific edge filter to a specific image. The available edge filters include: Sobel vertical, Sobel horizontal, Sobel all, Laplacian vertical and horizontal, Laplacian diagonal, Gradient North, Gradient South, and many others. EdgeDetectEffectCommand can be used to detect the edges in an image and then replace the values of the edges with calculated values.

The EdgeDetectStatisticalCommand class can be used to detect the edges in an image by applying a statistical filter that analyzes the variations of colors in all directions around each pixel.

The GlowCommand class can be used to make the colored edges in an image shine with a neon-like glow.

The SmoothEdgesCommand can be used to smooth the rough edges in an image.

The SkeletonCommand class can be used to find the skeleton of regions or objects in a binary image. The white color represents the objects and the black color represents the background. If the image is not 1-bit image, the threshold will be used to transform the image into a binary image before finding the skeleton.

The IntensityDetectCommand class does not use a filter to detect edges or lines, but for some images it is more effective than the filters in detecting lines that are lighter or darker than other parts of the image.

The UnsharpMaskCommand class sharpens an image by first creating a blurred version of the image. For each pixel in the image, the difference between the original pixel value and the blurred pixel value is determined. If the difference in pixel values exceeds a threshold value, the original pixel value is modified, sharpening the image.

The DirectionEdgeStatisticalCommand class can be used to detect the variation of colors in the specified direction using statistical indices. It is similar to EdgeDetectStatisticalCommand, but this class allows you to specify the direction angle.

The ColoredPencilCommand class can be used to apply an effect to an image that makes it look like it has been drawn with colored pencils.

The ColoredPencilExtendedCommand, like the ColoredPencilCommand, can be used to apply an effect to an image that makes it look like it has been drawn with colored pencils. It has more parameters than the ColoredPencilCommand class.

WCF Support

The Sharpen class is designed specifically to emphasize the edges (shifts in intensity) in an image. It is a high-level method that can be used alone for the desired effect.

The Spatial class provides several predefined filters for detecting edges or lines. (It also lets you define your own filter.) These filters can be used alone in applications, such as industrial inspection systems, that analyze images. They can also be used to create an image that is combined with the original to change the appearance of lines or edges.

Choosing a predefined filter is a subjective, application-specific decision. The filters use standard algorithms, some of which have similar purposes. You may need to experiment with them to choose the appropriate filter for your application. The following is a summary of the available filters:

Filter

Purpose

Emboss

Creates an image with an embossed appearance. (This is used for artistic effect, but is listed here because it is one of the predefined filters.)

Gradient directional

Detects edges, starting from any of eight specified directions. All pixels not on the detected edges are changed to black.

Prewitt

Detects horizontal or vertical edges. All pixels not on the detected edges are changed to black.

Sobel

Detects horizontal or vertical edges. All pixels not on the detected edges are changed to black. (The usage is the same as Prewitt, but the algorithm is different.)

Shift-and-difference

Detects horizontal, vertical, or diagonal edges. All pixels not on the detected edges are changed to black.

Laplacian

Detects lines. There are three Omni directional filters and three bi-directional ones. All pixels not on the detected lines are changed to black.

Line-segment

Detects line segments. Possible directions are horizontal, vertical, left-to-right diagonal, and right-to-left diagonal. You can use this filter to find line discontinuities in an image. All pixels not on the detected line segments are changed to black.

The EdgeDetector class can be used to apply a specific edge filter to a specific image. The available edge filters include: Sobel vertical, Sobel horizontal, Sobel all, Laplacian vertical and horizontal, Laplacian diagonal, Gradient North, Gradient South, and many others.

The IntensityDetect class does not use a filter to detect edges or lines, but for some images it is more effective than the filters in detecting lines that are lighter or darker than other parts of the image. The UnsharpMask class sharpens an image by first creating a blurred version of the image. For each pixel in the image, the difference between the original pixel value and the blurred pixel value is determined. If the difference in pixel values exceeds a threshold value, the original pixel value is modified, sharpening the image.

Help Version 19.0.2017.10.19
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Imaging, Medical, and Document