Image - Processing
Image - Processing
Introduction
Image Processing Lab is a simple tool for image processing, which includes different
filters and tools to analyze images available in AForge.NET framework. It's easy to
develop your own filters and to integrate them with the code or to use the tools in
HSL filtering);
extraction/replacement);
morph);
A preview window allows you to view results of changing filter parameters on the fly.
You can scroll an image using mouse in preview area. All filters are applied only to
A PhotoShop like histogram allows you to get information about mean, standard
The program allows to copy to or paste from clipboard, save and print images.
Most filters are designed to work with 24bpp RGB images or with grayscale images.
palette of 256 entries. To guarantee that your image is in one of the formats, you can
// load an image
// format image
// load an image
System.Drawing.Bitmap image = (Bitmap) Bitmap.FromFile( fileName );
// create filter
// apply filter
Suppose, you want to apply a series of filters to an image. The straight way to do it is
to apply filters one after another, but it's not very likely in the case of 3 or more filters.
filters and apply it at once to an image (besides, the collection will also save us from
AForge.Imaging.ImageStatistics statistics =
Image statistics can be easily combined with filters. Suppose, the minimum value of
red is 50 on the image and the maximum value is 200. So, we can normalize the
AForge.Imaging.Filters.LevelsLinear filter =
new AForge.Imaging.Filters.LevelsLinear( );
Or we can normalize the contrast of each channel, getting only the 90% ranges from
each channel:
AForge.Imaging.Filters.LevelsLinear filter =
new AForge.Imaging.Filters.LevelsLinear( );
HSL Filters
Using HSL color space is more obvious for some sort of filters. For example, it's not
very clean, how to adjust saturation level of an image using RGB color space. But it
// create filter
AForge.Imaging.Filters.SaturationCorrection filter =
Using HSL color space we can modify the hue value of pixels. Setting all hue values
// create filter
AForge.Imaging.Filters.HueModifier filter =
It's possible to get much more interesting results using HSL filtering. For example, we
can preserve only the specified range of hue values and desaturate all others out of the
range. So, it will lead to a black and white image with only some regions colored.
// create filter
AForge.Imaging.Filters.HSLFiltering filter =
new AForge.Imaging.Filters.HSLFiltering( );
filter.UpdateHue = false;
filter.UpdateLuminance = false;
There are many tasks, which can be solved using mathematical morphology filters.
For example, we can reduce noise on binary images using erosion, or we can separate
some objects with the filter. Using dilatation we can grow some parts of our interests
on the image. One of the most interesting morphological operators is known as Hit &
Miss. All other morphological operators can be expressed from the Hit & Miss
operator. For example, we can use it to search for particular structures on the image:
{ 0, 1, 0 },
{ 0, 1, 0 },
{ 0, 1, 0 }
};
AForge.Imaging.Filters.HitAndMiss vFilter =
{ 0, 0, 0 },
{ 1, 1, 1 },
{ 0, 0, 0 }
};
AForge.Imaging.Filters.HitAndMiss hFilter =
Original image Searching for vertical lines Searching for horizontal lines
Using thickening operator, we can grow some parts of the image in the places we
need. For example, the next sample will lead to thickening horizontal lines in the
bottom direction:
// create filter
AForge.Imaging.Filters.FilterIterator filter =
new AForge.Imaging.Filters.FilterIterator(
new AForge.Imaging.Filters.HitAndMiss(
Using thinning operator you can remove some unnecessary parts of the image. For
example, you can develop skeletonization filter with appropriate structuring elements:
Collapse
AForge.Imaging.Filters.FiltersSequence filterSequence =
new AForge.Imaging.Filters.FiltersSequence( );
HitAndMiss.Modes.Thinning ) );
HitAndMiss.Modes.Thinning ) );
HitAndMiss.Modes.Thinning ) );
HitAndMiss.Modes.Thinning ) );
HitAndMiss.Modes.Thinning ) );
filterSequence.Add(new AForge.Imaging.Filters.HitAndMiss(
HitAndMiss.Modes.Thinning ) );
HitAndMiss.Modes.Thinning ) );
AForge.Imaging.Filters.FilterIterator filter =
Fourier transformation
It is easy to perform Fourier transformation, which is useful for image analysis and
AForge.Imaging.ComplexImage cimage =
AForge.Imaging.ComplexImage.FromBitmap( bitmap );
cimage.ForwardFourierTransform( );
// lowpass filtering
cimage.BackwardFourierTransform( );
Blob counter
Blob counter is a very useful feature and can be applied in many different
applications. What does it do? It can count objects on a binary image and extract
them. The idea comes from 'Connected components labeling', a filter, which colors
each separate object with a different color. Let's look into a small sample:
// create filter
AForge.Imaging.Filters.ConnectedComponentsLabeling filter =
new AForge.Imaging.Filters.ConnectedComponentsLabeling( );
// apply filter
// objects count
filter.ObjectCount );
Here are two images: initial image and colored image. So, it looks like the filter is
Here is another example of objects counting and retrieving their position and size:
// process an image
// objects count
// objects dimension
System.Diagnostics.Debug.WriteLine(
It's possible to extract each object with the GetObjects method of BlobCounter:
// process an image
// process blobs
// ...
YCbCr filtering
YCbCr filters provides with similar functionality as RGB and HSL filters. The YCbCr
linear correction filter perform as its analogues from other color spaces, but operates
ways of color correction. The next small sample demonstrates the use of YCbCr linear
filter and the use of in-place filtering - the feature, which allows you to filter source
// create filter
// apply filter
filter.ApplyInPlace( image );
Perlin noise filters
Perlin noise has many applications and one of the most interesting of them is the
creation of different effects, like marble, wood, clouds, etc. Application of such
effects to images can be done within two steps. First step is to generate effect texture
and the second step is to apply the texture to particular image. Texture generators are
placed into Textures namespace of the library, which contains generators for such
effects like clouds, wood, marble, labyrinth and textile. All these texture generators
three filters. Fist one, Texturer, is for texturing image. The second, TexturedFilter,
allows applying any other filter to an images using texture as a mask. The third,
Collapse
// 1 - Marble effect
// create texture
// create filter
// 2 - Wood effect
// create filter
// apply filter
// 3 - Textile effect
// create filter
// apply filter
// 4 - Rusty effect
// apply filter
which provides all the filters and image processing routines available in the
application. To get more information about the framework, you may read dedicated
article on Code Project or visit project's home page, where you can get all the latest
information about it, participate in a discussion group or submit issues or requests for
enhancements.
Conclusion
I suppose the code may be interesting for someone who would like to start studying
image processing, for filters/effects developers. As for me, I'll use the tool for my
further research in computer vision. Besides, the library helped me very much in
SYSTEM IMPLEMENTATION
The completion of this thesis requires the following Software & Hardware
Software Requirements
Hardware Requirements
PROCESSOR - Pentium IV
RAM - 32 MB
SECONDARY STORAGE - 1 MB
MOUSE - Logitech
Microsoft.NET Framework
available for the compiler vendors in the form of common language specification
language to compile into a common platform. The compiler vendors must design
the compiler in such a way that the compiled code conforms these specifications.
These compilers compile the programs written in the high level language into a
Intermediate
High Level Compiler Language
Language format
This IL code format is not the machine language code. So, in order to execute
the program we need to compile it again into machine language.This is done by the
CLR takes the IL code as input and Compiles it and executes it.
Source
Code Compiler IL Format CLR
Source DLL in
Code in C# .NET C# IL Format CLR
Compiler (C.DLL)
C#.NET framework
Microsoft .NET
Compiler for C#
CLR Debugger
Some utilities
C# Base Classes :
A significant part of the power of the .Net framework comes from the base
classes supplied by microsoft as part of the .NET framework. These classes are all
callable from C# and provide the bind of basic functionality that is needed by many
The types of purposes you can use the base classes to do include
String handling
Security
Windowing
Windows messages
tool for building .NET-connected software for Microsoft Windows, the Web, and a
wide range of devices. With syntax that resembles C++, a flexible integrated
development environment (IDE), and the capability to build solutions across a variety
of platforms and devices, Visual C# .NET 2003 significantly eases the development of
.NET-connected software.
"unsafe" code for maximum developer control, and powerful new language constructs
overloading, and custom attributes. With XML comments, C# developers can produce
which they can exchange code and resources, leverage skills across multiple
With a superior IDE, Visual C# .NET provides users with the ultimate
online resources. The Start Page offers developers a one-click portal to updates,
preferences, information on recently used projects, and the MSDN Online community.
Improved IntelliSense, the Toolbox, and the Task List provide significant productivity
environment. New custom build rules make developing robust and powerful software
Using the Web Forms Designer and XML Designer, developers can use
IntelliSense features and tag completion or the WYSIWYG editor for drag-and-drop
programmers can design, develop, debug, and deploy powerful XML Web services
any platform.
With Visual C# .NET 2003, developers can take advantage of Microsoft .NET
and remoting. With Microsoft .NET, developers gain superior memory management
technology for seamless garbage collection and reduced program complexity.
Developers can use the Microsoft .NET Framework Common Type System to
leverage code written in any of more than 20 languages that support .NET, while
Developers can also use the tested and proven .NET Framework class library
networking support, multithreading support, string and regular expression classes, and
broad support for XML, XML schemas, XML namespaces, XSLT, XPath, and SOAP.
And, with the Java Language Conversion Assistant (JLCA), programmers can begin
Using Visual C# .NET 2003, developers can construct powerful Web services
that encapsulate business processes and make them available to applications running
on any platform. Developers can easily incorporate any number of Web services that
Visual C# .NET 2003 also enables developers to build the next generation of
common logic and user interface for their entire solution. Using control anchoring and
docking, programmers can build resizable forms automatically, while the in-place
menu editor enables developers to visually author menus directly from within the
Forms Designer.
Visual C# .NET 2003 is a modern, innovative programming language and tool
for building .NET-connected software for Microsoft Windows, the Web, and a wide
environment (IDE), and the capability to build solutions across a variety of platforms
and devices, Visual C# .NET 2003 significantly eases the development of .NET-
connected software.
bringing together the development community and valuable online resources. The
recently used projects, and the MSDN Online community. Improved IntelliSense, the
Toolbox, and the Task List provide significant productivity enhancements, while
With Visual C# .NET 2003, developers can take advantage of Microsoft .NET
and remoting. With Microsoft .NET, developers gain superior memory management
Developers can use the Microsoft .NET Framework Common Type System to
leverage code written in any of more than 20 languages that support .NET, while