Detecting and Enhancing Edges and Lines

The L_SharpenBitmap function is designed specifically to emphasize the edges (shifts in intensity) in a bitmap. It is a high-level function that can be used alone for the desired effect.

The L_SpatialFilterBitmap function 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 omnidirectional 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 a bitmap, filter each one with a different Laplacian directional filter, and use the L_CombineBitmap function to create a bitmap with all of the detected lines. You could then combine this resulting bitmap with the original to enhance the lines in the original.

The L_DiffuseGlowBitmap function adds a colored glow to a bitmap's light or dark areas, making these areas shine with a neon glow.

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

The L_EdgeDetectStatisticalBitmap function can be used to detect the edges in a bitmap by applying a statistical filter that analyzes the variations of colors in all directions around each pixel.

The L_GlowFilterBitmap function can be used to make the colored edges in a bitmap shine with a neon-like glow.

L_ColoredPencilBitmap and L_ColoredPencilBitmapExt functions apply a colored pencil effect to a bitmap. Both functions brighten the bitmap and enhance its edges.

The L_HighPassFilterBitmap function removes low frequency details in a bitmap, resulting in a sharpened image. The effect is opposite to that of the Gaussian Blur filter (L_GaussianFilterBitmap). Unlike the L_UnsharpMaskBitmap function, when using this function image noise is not increased.

The L_MaskConvolutionBitmap function multiplies the pixels of an image by a mask, resulting in one of several 3D edge effects being applied to the image.

The L_SmoothEdgesBitmap function can be used to smooth the rough edges in a bitmap.

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

The L_IntensityDetectBitmap function 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 L_UnsharpMaskBitmap sharpens an image by first creating a blurred version of the image. For each pixel in the bitmap, 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 L_DirectionEdgeStatisticalBitmap function can be used to detect the variation of colors in the specified direction using statistical indices. It is similar to L_EdgeDetectStatisticalBitmap, but this function allows you to specify the direction angle.

Help Version 20.0.2020.4.3
Products | Support | Contact Us | Intellectual Property Notices
© 1991-2020 LEAD Technologies, Inc. All Rights Reserved.

LEADTOOLS Raster Imaging C API Help