|
Location: Computer science - Image processing License: The Intelliproject Open License (IPOL) Image Processing - Convolution Filters with c++ and GDI+Posted by Silviu CarageaA brief description of several useful convolution filters which allows you to apply various effects on photos for certain features. |
Skill: AdvancedPosted: 29/10/2008Views: 965Rating: 5.00 /5Popularity: 0.00 |
| Sign Up to vote for this article |
Image Convolution filters allows you to apply various effects on photos for certain features.
In essential a convolution filter it’s just a matrix. For every pixel of the image you take the sum of products. Each product is the color value of the current pixel or a neighbor of it, with the corresponding value of the filter matrix. The sum of the products is divided by a factor, and optionally is added an offset value.
Usually the factor is the sum of all values in the matrix filter, which ensures the end value will be in the range 0-255.
There are numerous types of matrix filters: smoothing, Gaussian blur, edge detection, etc. The main issue in matrix convolution is that it requires a biggest number of computations. To avoid this issue you can reduce the size of the filter. Most of the time small filters 3x3 can do the job perfectly.

You can use the following class to apply 6 different convolution filters described hereinafter.
The following function applies a specified convolution filter to an image buffer bytes. The image should be in RGB24 pixel format.BYTE * pBuff – image bufferint nWidth – image widthint nHeight – image heightUINT filter – convolution filter identifier as follow:
The following method converts a RGB image to gray scale.BYTE *picData – image bufferint nWidth – image widthint nHeight – image heightint nBitCount – number of bits per pixel
The following function applies a color subtraction filter to a specified image.BYTE *picSrc – image bufferint width – image widthint height – image heightint bpp – bytes per pixel
This effect is applied in order to reduce noise and/or to prepare images for further processing such as segmentation. The output image is based on a local averaging of the input filter where all of the values within the filter support have the same weight.

Gaussian blur, it is a widely used effect in graphics software, typically to reduce image noise and reduce detail. A Gaussian Blur is distinct from other blurs in that it has a well defined effect on different levels of detail within an image. As the level of detail becomes smaller the filter lets through less and less. With other types of blur (e.g. Mean Filter) the amount let through may vary considerably.

Sharpening filters are used to enhance the edges of objects and adjust the contrast and the shade characteristics. In combination with threshold they can be used as edge detectors. Sharpening or high-pass filters let high frequencies pass and reduce the lower frequencies and are extremely sensitive to shut noise.

This filter sharpens the image by changing the colors of neighboring pixels with approximately the same color, so that small differences are evened out.

The Emboss filter makes a selection appear raised or stamped by suppressing the color within the selection and tracing its edges with black.

Edge detection is a terminology in image processing and computer vision, particularly in the areas of feature detection and feature extraction, to refer to algorithms which aim at identifying points in a digital image at which the image brightness changes sharply or more formally has discontinuities.

| 02/11/2008 | Image size limitation was removed
Few minor bugs fixed |
This article, along with any associated source code and files, is licensed under The Intelliproject Open License (IPOL)
| Silviu Caragea
| Silviu Caragea is the Founder, Administrator and Chief Editor who wrote and runs The IntelliProject. He's been programming since 2000 and now he's student at The Faculty of Economic Cybernetics, Statistics and Informatics from Bucharest. In the same time he's working as software developer at Cratima Software, a Romanian software and web design company that activates both on the local and foreign market, providing its customers with software development services, internet and intranet solutions, web design, graphic design and IT consultancy. His programming experience includes: - C,C++, Visual C++(Win32 API, MFC, ADO, STL, DAO, ODBC, ATL, COM, DirectShow, DirectDraw, WTL) - Open Source libraries :CURL & Boost - HTML, CSS - Java (SE,ME) - JavaScript, Ajax, Google Web Toolkit (GWT) - Php, MySQL -Oracle, PL SQL - C# .NET -Objective C, IPhone SDK, Cocoa Location: |
Sign up to post message on the article message board!