Products | Support | Send comments on this topic. | Email a link to this topic. | Back to Getting Started | Help Version 18.0.10.24
LEADTOOLS Raster imaging C++ Class library help

Detecting and Enhancing Edges and Lines

Show in webframe

The LBitmap::Sharpen 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 LBitmap::SpatialFilter 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 LBitmapBase::Combine 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 LBitmap::DiffuseGlow function adds a colored glow to a bitmap's light or dark areas, making these areas shine with a neon glow.

The LBitmap::EdgeDetector and LBitmap::EdgeDetector2 functions applies a specific edge filter to an unsigned image, while the LBitmap::EdgeDetector2 function applies a specific edge filter to an signed 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. LBitmap::EdgeDetectEffect can be used to detect the edges in a bitmap and then replace the values of the edges with calculated values.

The LBitmap::EdgeDetectStatistical and LBitmap::EdgeDetectStatistical2 functions detects the edges in an unsigned bitmap , while LBitmap::EdgeDetectStatistical2 function detects the edges in an signed bitmap. This is performed by applying a statistical filter that analyzes the variations of colors in all directions around each pixel.

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

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

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

The LBitmap::ColoredPencil and LBitmap::ColoredPencilExt functions apply a colored pencil effect to a bitmap. Both functions brighten the bitmap and enhance its edges.

The LBitmap::SmoothEdges function can be used to smooth the rough edges in a bitmap.

The LBitmap::Skeleton and LBitmap::Skeleton2 functions finds the skeleton of regions or objects in an unsigned binary bitmap, while LBitmap::Skeleton2 function finds the skeleton of regions or objects in a signed 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 LBitmap::IntensityDetect 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 LBitmap::UnsharpMask 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 LBitmap::EdgeDetectEffect function performs edge detection on the image.

The LBitmap::DirectionEdgeStatistical and LBitmap::DirectionEdgeStatistical2 functions detects the variation of colors in the specified direction in an unsigned bitmap using statistical indices, while LBitmap::DirectionEdgeStatistical2 function detects the variation of colors in the specified direction in a signed bitmap using statistical indices. They are similar to LBitmap::EdgeDetectStatistical and LBitmap::EdgeDetectStatistical2, but they allow you to specify the direction angle.

Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.