You are on page 1of 25


Digital image processing is the use of computer algorithms to perform image processing on
digital images. Digital image processing has the same advantages over analog image processing
as digital signal processing has over analog signal processing ² it allows a much wider range of
algorithms to be applied to the input data, and can avoid problems such as the build-up of noise
and signal distortion during processing. The most common kind of digital image processing is
digital image editing.
Pattern recognition aims to classify data (patterns) based on either a priori knowledge or
on statistical information extracted from the patterns. The patterns to be classified are usually
groups of measurements or observations, defining points in an appropriate multidimensional
space. This is in contrast to pattern matching, where the pattern is rigidly specified.

Table of Contents
1. Front Page
2. Candidate Declaration
3. Certificate
4. Certificate (External, Internal)
5. Acknowledgement
6. 1.Fundamentals
7. 2.Image formats supported by Matlab
8. 3.Working formats in Matlab
9. 4.Intensity image (gray scale image)
10. 5.Binary image
11. 6.Indexed image
12. 7.RGB image
13. 8.Multiframe image
14. 9.How to convert between different formats
15. 10.Image format conversion
16. . How to display an image in Matlab

Working with Strings in MATLAB
Distance Measures in MATLAB
Forming Pattern Vectors
Recognition Based on Decision-Theoretic Methods

Image: An image may be defined as a two-dimensional function ( x,y ) ,where x and y are spatial
(plane) coordinates, and the amplitude of f at any pair of coordinates (x,y)is called the intensity or gray
level of the image at that point.

Analog Image: Can be mathematically represented as a continuous range of values representing
position and intensity.
Digital Image: a digital image is restricted in both its spatial coordinates and in its allowed
The field of digital image processing refers to processing digital images by means of a digital
computer. Note that a digital image is composed of a finite number of elements, each of
which has a particular location and value. These elements are referred to as picture
elements, image elements, pels, and pixels. Pixel is the term most widely used to denote the
elements of a digital image

A digital image is composed of pixels which can be thought of as small dots on the screen. A
digital image is an instruction of how to color each pixel. We will see in detail later on how
this is done in practice. A typical size of an image is 512-by-512 pixels. Later on in the
course you will see that it is convenient to let the dimensions of the image to be a power of 2.
For example, 2
=512. In the general case we say that an image is of size m-by-n if it is
composed of m pixels in the vertical direction and n pixels in the horizontal direction.
Let us say that we have an image on the format 512-by-1024 pixels. This means that the data
for the image must contain information about 524288 pixels, which requires a lot of memory!
Hence, compressing images is essential for efficient image processing. You will later on see
how Fourier analysis and Wavelet analysis can help us to compress an image significantly.
There are also a few "computer scientific" tricks (for example entropy coding) to reduce the
amount of data required to store an image.
Image formats supported by Matlab
The following image formats are supported by Matlab:
Most images you find on the Internet are JPEG-images which is the name for one of the most
widely used compression standards for images. If you have stored an image you can usually
see from the suffix what format it is stored in. For example, an image named myimage.jpg is
stored in the JPEG format and we will see later on that we can load an image of this format
into Matlab.
Working formats in Matlab
If an image is stored as a JPEG-image on your disc we first read it into Matlab. However, in
order to start working with an image, for example perform a wavelet transform on the image,
we must convert it into a different format. This section explains four common formats.
Intensity image (gray scale image)
This is the equivalent to a "gray scale image" and this is the image we will mostly work with
in this course. It represents an image as a matrix where every element has a value
corresponding to how bright/dark the pixel at the corresponding position should be colored.
There are two ways to represent the number that represents the brightness of the pixel:
The double class (or data type). This assigns a floating number ("a number with decimals")
between 0 and 1 to each pixel. The value 0 corresponds to black and the value 1 corresponds
to white. The other class is called uint8 which assigns an integer between 0 and 255 to
represent the brightness of a pixel. The value 0 corresponds to black and 255 to white. The
class uint8 only requires roughly 1/8 of the storage compared to the class double. On the
other hand, many mathematical functions can only be applied to thedouble class. We will see
later how to convert between double and uint8.
Binary image
This image format also stores an image as a matrix but can only color a pixel black or white
(and nothing in between). It assigns a 0 for black and a 1 for white.
Indexed image
This is a practical way of representing color images. (In this course we will mostly work with
gray scale images but once you have learned how to work with a gray scale image you will
also know the principle how to work with color images.) An indexed image stores an image
as two matrices. . e first matrix has the same size as the image and one number for each pixel.
The second matrix is called the color map and its size may be different from the image. The
numbers in the first matrix is an instruction of what number to use in the color map matrix.
RGB image
This is another format for color images. It represents an image with three matrices of sizes
matching the image format. Each matrix corresponds to one of the colors red, green or blue
and gives an instruction of how much of each of these colors a certain pixel should use.
Multiframe image
In some applications we want to study a sequence of images. This is very common in
biological and medical imaging where you might study a sequence of slices of a cell. For
these cases, the multiframe format is a convenient way of working with a sequence of
images. In case you choose to work with biological imaging later on in this course, you may
use this format.
How to convert between different formats
The following table shows how to convert between the different formats given above. All
these commands require the Image processing tool box!
Image format conversion
(Within the parenthesis you type the name of the image you wish to convert.)
Operation: Matlab command:
Convert between intensity/indexed/RGB format to binary format. dither()
Convert between intensity format to indexed format. gray2ind()
Convert between indexed format to intensity format. ind2gray()
Convert between indexed format to RGB format. ind2rgb()
Convert a regular matrix to intensity format by scaling. mat2gray()
Convert between RGB format to intensity format. rgb2gray()
Convert between RGB format to indexed format. rgb2ind()
The command mat2gray is useful if you have a matrix representing an image but the values
representing the gray scale range between, let's say, 0 and 1000. The
command mat2gray automatically re scales all entries so that they fall within 0 and 255 (if
you use the uint8 class) or 0 and 1 (if you use the double class).
How to convert between double and uint8
When you store an image, you should store it as a uint8 image since this requires far less
memory than double. When you are processing an image (that is performing mathematical
operations on an image) you should convert it into a double. Converting back and forth
between these classes is easy.
converts an image named I from uint8 to double.
converts an image named I from double to uint8.
How to read files
When you encounter an image you want to work with, it is usually in form of a file (for
example, if you down load an image from the web, it is usually stored as a JPEG-file). Once
we are done processing an image, we may want to write it back to a JPEG-file so that we can,
for example, post the processed image on the web. This is done using
the imread and imwrite commands.These commands require the Image processing tool box!
Reading and writing image files
Read an image.
(Within the parenthesis you type the name of the image file you wish to
Put the file name within single quotes ' '.)
Write an image to a file.
(As the first argument within the parenthesis you type the name of the image
you have worked with.
As a second argument within the parenthesis you type the name of the file
imwrite( , )
and format that you want to write the image to.
Put the file name within single quotes ' '.)
Make sure to use semi-colon ; after these commands, otherwise you will get LOTS OF
number scrolling on you screen... The commands imread and imwrite support the formats
given in the section "Image formats supported by Matlab" above.
Loading and saving variables in Matlab
This section explains how to load and save variables in Matlab. Once you have read a file,
you probably convert it into an intensity image (a matrix) and work with this matrix. Once
you are done you may want to save the matrix representing the image in order to continue to
work with this matrix at another time. This is easily done using the commands save and load.
Note thatsave and load are commonly used Matlab commands, and works independently of
what tool boxes that are installed.
Loading and saving variables
Operation: Matlab command:
Save the variable X . save X
Load the variable X . load X
In the first example we will down load an image from the web, read it into Matlab,
investigate its format and save the matrix representing the image.
Example 1.
Down load the following image (by clicking on the image using the right mouse button) and
save the file as cell1.jpg.
This is an
image of a cell
taken by an
microscope at
Department of
Cellular and
l Biology at
Now open Matlab and make sure you are in the same directory as your stored file. (You can
check what files your directory contains by typing ls at the Matlab prompt. You change
directory using the command cd.) Now type in the following commands and see what each
command does. (Of course, you do not have to type in the comments given in the code after
the% signs.)

I=imread('cell1.jpg'); % Load the image file and store it as the variable I.
whos % Type "whos" in order to find out the size and class of all stored variables.
save I % Save the variable I.
ls % List the files in your directory.
% There should now be a file named "I.mat" in you directory
% containing your variable I.
Note that all variables that you save in Matlab usually get the suffix .mat.
Next we will see that we can display an image using the command imshow. This command
requires the image processing tool box. Commands for displaying images will be explained in
more detail in the section "How to display images in Matlab" below.

clear % Clear Matlab's memory.
load I % Load the variable I that we saved above.
whos % Check that it was indeed loaded.
imshow(I) % Display the image
I=im2double(I); % Convert the variable into double.
whos % Check that the variable indeed was converted into double
% The next procedure cuts out the upper left corner of the image
% and stores the reduced image as Ired.
for i=1:256
for j=1:256
whos % Check what variables you now have stored.
imshow(Ired) % Display the reduced image.
Example 2
Go to the CU home page and down load the image of campus with the Rockies in the
background. Save the image as pic-home.jpg
Next, do the following in Matlab. (Make sure you are in the same directory as your image

Note that when you typed whos it probably said that the size was 300x504x3. This means that
the image was loaded as an RGB image (see the section "RGB image above"). However, in
this course we will mostly work with gray scale images, so let us convert it into a gray scale
(or "intensity") image.

A=rgb2gray(A); % Convert to gray scale
Now the size indicates that our image is nothing else than a regular matrix.
Note: In other cases when you down load a color image and type whos you might see that
there is one matrix corresponding to the image size and one matrix called map stored in
Matlab. In that case, you have loaded an indexed image (see section above). In order to
convert the indexed image into an intensity (gray scale) image, use the ind2gray command
described in the section "How to convert between different formats" above.
How to display an image in Matlab
Here are a couple of basic Matlab commands (do not require any tool box) for displaying an
Displaying an image given on matrix form
Operation: Matlab command:
Display an image represented as the matrix X. imagesc(X)
Adjust the brightness. s is a parameter such that
-1<s<0 gives a darker image, 0<s<1 gives a brighter image.
Change the colors to gray. colormap(gray)
Sometimes your image may not be displayed in gray scale even though you might have
converted it into a gray scale image. You can then use the command colormap(gray) to
"force" Matlab to use a gray scale when displaying an image.
If you are using Matlab with an Image processing tool box installed, I recommend you to use
the command imshow to display an image.
Displaying an image given on matrix form (with image processing tool box)
Operation: Matlab command:
Display an image represented as the matrix X. imshow(X)
Zoom in (using the left and right mouse button). zoom on
Turn off the zoom function. zoom off

y Analysis

Objective of Project

In this Project we are using an analog image and than converted into the digital image and
than proceed by matlab tool
Requirement Gathering
In our project we are using the following matlab tools for digitalizing and processing an
List of the Matlab tools are given blow
1. M-Files
2. Operators
3. Flow Control
4. Code Optimization
5. InteractiveRepresentation and Description
6. Some Additional MATLAB and IPT Functions Used
7. Some Basic Utility M-Functions 433
x Contents
8. Chain Codes
9. Polygonal Approximations Using Minimum-Perimeter
10. Shape Numbers
11. Descriptors 463
11.4.1 Function
12. Statistical Moments
13. Fourier Descriptors
14. Object Recognition
15. Working with Strings in MATLAB
16. Distance Measures in MATLAB
17. Computing
18. Forming Pattern Vectors
19. Recognition Based on Decision-Theoretic Methods
20. Representation and Description
21. Some Additional MATLAB and IPT Functions Used
22. Some Basic Utility M-Functions 433
x Contents
23. Chain Codes
24. Polygonal Approximations Using Minimum-Perimeter
25. Shape Numbers
26. Descriptors 463
11.4.1 Function
27. Statistical Moments
28. Fourier Descriptors
29. Object Recognition
30. Working with Strings in MATLAB
31. Distance Measures in MATLAB
32. Computing
33. Forming Pattern Vectors
34. Recognition Based on Decision-Theoretic Methods
35. Representation and Description
36. Some Additional MATLAB and IPT Functions Used
37. Some Basic Utility M-Functions 433
x Contents
38. Chain Codes
39. Polygonal Approximations Using Minimum-Perimeter
40. Shape Numbers
41. Descriptors 463
11.4.1 Function
42. Statistical Moments
43. Fourier Descriptors
44. Object Recognition
45. Working with Strings in MATLAB
46. Distance Measures in MATLAB
47. Computing
48. Forming Pattern Vectors
49. Recognition Based on Decision-Theoretic Methods
50. Representation and Description
51. Some Additional MATLAB and IPT Functions Used
52. Some Basic Utility M-Functions 433
x Contents
53. Chain Codes
54. Polygonal Approximations Using Minimum-Perimeter
55. Shape Numbers
56. Descriptors 463
11.4.1 Function
57. Statistical Moments
58. Fourier Descriptors
59. Object Recognition
60. Working with Strings in MATLAB
61. Distance Measures in MATLAB
62. Computing
63. Forming Pattern Vectors
64. Recognition Based on Decision-Theoretic Methods

65. 2 Logarithmic and Contrast-Stretching Transformations
66. Generating and Plotting Image Histograms
67. Histogram Equalization
68. Obtaining Frequency Domain Filters from Spatial Filters
69. Spatial Filtering
70. Linear Spatial Filtering
71. Nonlinear Spatial Filtering
72. Image Processing Toolbox Standard Spatial Filters
73. Linear Spatial Filters
74. Nonlinear Spatial Filters
75. Freque
76. Preview Computing and Visualizing the 2-D DFT in MATLAB
77. An M-function for Filtering in the Frequency Domain
78. Histogram Matching (Specification)
79. Restoration in the Presence of Noise Only²Spatial Filtering
80. High-Frequency Emphasis Filtering
81. 5 Image Restoration
82. Model of the Image Degradation/Restoration Process
83. Lowpass Frequency Domain Filters 129
4.5.3 Wireframe and Surface Plotting
84. Modeling the Degradation Function
85. Direct Inverse Filtering
86. Constrained Least Squares (Regularized) Filtering
87. Using the Lucy-Richardson
88. Iterative Nonlinear Restoration
89. 10.4.1 Basic Formulation 407

90. Segmentation Using the Watershed Transform
91. -Controlled Watershed Segmentation
92. Summary 425

93. Region Splitting and Merging
94. Representation and Description
95. Some Additional MATLAB and IPT Functions Used
96. Some Basic Utility M-Functions 433
x Contents
97. Chain Codes
98. Polygonal Approximations Using Minimum-Perimeter
99. Representation and Description
100. Some Additional MATLAB and IPT Functions Used
101. Some Basic Utility M-Functions 433
x Contents
102. Chain Codes
103. Polygonal Approximations Using Minimum-Perimeter
104. Shape Numbers
105. Descriptors 463
11.4.1 Function
106. Statistical Moments
107. Fourier Descriptors
108. Representation and Description
109. Some Additional MATLAB and IPT Functions Used
110. Some Basic Utility M-Functions 433
x Contents
111. Chain Codes
112. Polygonal Approximations Using Minimum-Perimeter
113. Shape Numbers
114. Descriptors 463
11.4.1 Function
115. Statistical Moments
116. Fourier Descriptors
117. Object Recognition

Design and simulate signal processing systems

Signal Processing BlocksetΠprovides algorithms and tools for the design and simulation of
signal processing
systems. You can develop DSP algorithms for speech and audio processing, radar tracking,
communications, and other applications. Most algorithms and tools are available as both
System objects (for use
in MATLAB®) and blocks (for use in Simulink®).
The blockset provides techniques for FFTs, FIR and IIR digital filtering, spectral estimation,
statistical and linear
algebra computations, streaming, and multirate processing. It also includes signal generators,
interactive scopes,
spectrum analyzers, and other tools for visualizing signals and simulation results.
You can use the blockset to develop and validate real-time signal processing systems. For
embedded system design
and rapid prototyping, the blockset supports fixed-point arithmetic, C-code generation, and
implementation on
embedded hardware.
Key Features
ƒ Simulation of streaming, frame-based, and multirate systems
ƒ System objects for use in MATLAB and blocks for use in Simulink
ƒ Algorithms for FFT and other transforms, spectral estimation, windowing, signal statistics,
and linear algebra
ƒ Design and realization architectures for FIR, IIR, multirate, and LMS and RMS adaptive
ƒ Signal generators and I/O support for multimedia files and devices, including multichannel
ƒ Fixed-point data type modeling and bit-true simulation
ƒ Support for automatic C-code generation

Software Requirement
About J2EE & Microsoft Access
Java is a small, simple, safe, object oriented, interpreted or dynamically optimized, byte
coded, architectural, garbage collected, multithreaded programming language with a strongly
typed exception-handling for writing distributed and dynamically extensible programs.
Java is an object oriented programming language. Java is a high-level, third generation
language like C, FORTRAN, Small talk, Pearl and many others. You can use java to write
computer applications that crunch numbers, process words, play games, store data or do any
of the thousands of other things computer software can do.
Special programs called applets that can be downloaded from the internet and played safely
within a web browser. Java a supports this application and the follow features make it one of
the best programming language.
It is simple and object oriented
It helps to create user friendly interfaces.
It is very dynamic.
It supports multithreading.
It is platform independent
It is highly secure and robust.
It supports internet programming
Java is a programming language originally developed by Sun Microsystems and released in 1995 as a
core component of Sun's Java platform. The language derives much of its syntax from C and C++ but
has a simpler object model and fewer low-level facilities. Java applications are typically compiled to
byte code which can run on any Java virtual machine (JVM) regardless of computer architecture.
The original and reference implementation Java compilers, virtual machines, and class libraries were
developed by Sun from 1995. As of May 2007, in compliance with the specifications of the Java
Community Process, Sun made available most of their Java technologies as free software under the
GNU General Public License. Others have also developed alternative implementations of these Sun
technologies, such as the GNU Compiler for Java and GNU Classpath.
The Java language was created by James Gosling in June 1991 for use in a set top box
project. The language was initially called Oak, after an oak tree that stood outside Gosling's office -
and also went by the name Green - and ended up later being renamed to Java, from a list of random
words. Gosling's goals were to implement a virtual machine and a language that had a familiar C/C++
style of notation.
Primary goals
There were five primary goals in the creation of the Java language:
1. It should use the object-oriented programming methodology.
2. It should allow the same program to be executed on multiple operating systems.
3. It should contain built-in support for using computer networks.
4. It should be designed to execute code from remote sources securely.
5. It should be easy to use by selecting what were considered the good parts of other object-
oriented languages.

The Java platform is the name for a bundle of related programs, or platform, from Sun which allow
for developing and running programs written in the Java programming language. The platform is not
specific to any one processor or operating system, but rather anexecution engine (called a virtual
machine) and a compiler with a set of standard libraries which are implemented for various
hardware and operating systems so that Java programs can run identically on all of them.
Different "editions" of the platform are available, including:
y Java ME (Micro Edition): Specifies several different sets of libraries (known as profiles) for
devices which are sufficiently limited that supplying the full set of Java libraries would take
up unacceptably large amounts of storage.
y Java SE (Standard Edition): For general purpose use on desktop PCs, servers and similar
y Java EE (Enterprise Edition): Java SE plus various APIs useful for multi-tier client-server
enterprise applications.

The Java Platform consists of several programs, each of which provides a distinct
portion of its overall capabilities. For example, the Java compiler, which converts Java source code
into Java bytecode (an intermediate language for the Java Virtual Machine (JVM)), is provided as part
of the Java Development Kit (JDK). The sophisticated Java Runtime Environment (JRE),
complementing the JVM with a just-in-time (JIT) compiler, converts intermediate bytecode into
native machine code on the fly. Also supplied are extensive libraries (pre-compiled into Java
bytecode) containing reusable code, as well as numerous ways for Java applications to be deployed,
including being embedded in a web page as an applet. There are several other components, some
available only in certain editions.
The essential components in the platform are the Java language compiler, the
libraries, and the runtime environment in which Java intermediate bytecode "executes" according to
the rules laid out in the virtual machine specification.

Java Virtual Machine
The heart of the Java Platform is the concept of a "virtual machine" that executes
Java bytecode programs. This bytecode is the same no matter what hardware or operating
system the program is running under. There is a JIT compiler within the Java Virtual
Machine, or JVM. The JIT compiler translates the Java bytecode into native processor
instructions at run-time and caches the native code in memory during execution.

The use of bytecode as an intermediate language permits Java
programs to run on any platform that has a virtual machine available. The use of a JIT
compiler means that Java applications, after a short delay during loading and once they have
"warmed up" by being all or mostly JIT-compiled, tend to run about as fast as native
programs. Since JRE version 1.2, Sun's JVM implementation has included a just-in-time
compiler instead of an interpreter.

Although Java programs are Platform Independent, the code of the
Java Virtual Machine (JVM) that execute these programs are not. Every Operating System
has its own JVM.

Class libraries
In most modern operating systems, a large body of reusable code is provided
to simplify the programmer's job. This code is typically provided as a set of dynamically
loadable libraries that applications can call at runtime. Because the Java Platform is not
dependent on any specific operating system, applications cannot rely on any of the existing
libraries. Instead, the Java Platform provides a comprehensive set of standard class libraries,
containing much of the same reusable functions commonly found in modern operating

The Java class libraries serve three purposes within the Java Platform. Like
other standard code libraries, they provide the programmer a well-known set of functions to
perform common tasks, such as maintaining lists of items or performing complex string
parsing. In addition, the class libraries provide an abstract interface to tasks that would
normally depend heavily on the hardware and operating system. Tasks such as network
access and file access are often heavily dependent on the native capabilities of the platform.
The Java and libraries implement the required native code internally, then
provide a standard interface for the Java applications to perform those tasks. Finally, when
some underlying platform does not support all of the features a Java application expects, the
class libraries can either emulate those features using whatever is available, or at least
provide a consistent way to check for the presence of a specific feature.
Platform independence
One characteristic, platform independence, means that programs written in the Java language must
run similarly on any supported hardware/operating-system platform. One should be able to write a
program once, compile it once, and run it anywhere.
This is achieved by most Java compilers by compiling the Java language code halfway (to Java
bytecode) ʹ simplified machine instructions specific to the Java platform. The code is then run on a
virtual machine (VM), a program written in native code on the host hardware that interprets and
executes generic Java bytecode. (In some JVM versions, bytecode can also be compiled to native
code, either before or during program execution, resulting in faster execution.) Further,
standardized libraries are provided to allow access to features of the host machines (such as
graphics, threading and networking) in unified ways. Note that, although there is an explicit
compiling stage, at some point, the Java bytecode is interpreted or converted to native machine
code by the JIT compiler.

The first implementations of the language used an interpreted virtual machine to achieve portability.
These implementations produced programs that ran more slowly than programs compiled to native
executables, for instance written in C or C++, so the language suffered a reputation for poor
performance. More recent JVM implementations produce programs that run significantly faster than
before, using multiple techniques.

One technique, known as just-in-time compilation (JIT), translates the Java bytecode into native code
at the time that the program is run, which results in a program that executes faster than interpreted
code but also incurs compilation overhead during execution. More sophisticated VMs use dynamic
recompilation, in which the VM can analyze the behavior of the running program and selectively
recompile and optimize critical parts of the program. Dynamic recompilation can achieve
optimizations superior to static compilation because the dynamic compiler can base optimizations
on knowledge about the runtime environment and the set of loaded classes, and can identify the hot
spots (parts of the program, often inner loops, that take up the most execution time). JIT
compilation and dynamic recompilation allow Java programs to take advantage of the speed of
native code without losing portability.

Another technique, commonly known as static compilation, is to compile directly into native code
like a more traditional compiler. Static Java compilers, such as GCJ, translate the Java language code
to native object code, removing the intermediate bytecode stage. This achieves good performance
compared to interpretation, but at the expense of portability; the output of these compilers can only
be run on a single architecture. Some see avoiding the VM in this manner as defeating the point of
developing in Java; however it can be useful to provide both a generic bytecode version, as well as
an optimised native code version of an application.

Automatic memory management

One of the ideas behind Java's automatic memory management model is that programmers be
spared the burden of having to perform manual memory management. In some languages the
programmer allocates memory for the creation of objects stored on the heap and the responsibility
of later deal locating that memory also resides with the programmer. If the programmer forgets to
deallocate memory or writes code that fails to do so, a memory leak occurs and the program can
consume an arbitrarily large amount of memory. Additionally, if the program attempts to deallocate
the region of memory more than once, the result is undefined and the program may become
unstable and may crash. Finally, in non garbage collected environments, there is a certain degree of
overhead and complexity of user-code to track and finalize allocations. Often developers may box
themselves into certain designs to provide reasonable assurances that memory leaks will not occur.

In Java, this potential problem is avoided by automatic garbage collection. The programmer
determines when objects are created, and the Java runtime is responsible for managing the object's
lifecycle. The program or other objects can reference an object by holding a reference to it (which,
from a low-level point of view, is its address on the heap). When no references to an object remain,
the Java garbage collector automatically deletes the unreachable object, freeing memory and
preventing a memory leak. Memory leaks may still occur if a programmer's code holds a reference to
an object that is no longer neededͶin other words, they can still occur but at higher conceptual
The use of garbage collection in a language can also affect programming paradigms. If, for example,
the developer assumes that the cost of memory allocation/recollection is low, they may choose to
more freely construct objects instead of pre-initializing, holding and reusing them. With the small
cost of potential performance penalties (inner-loop construction of large/complex objects), this
facilitates thread-isolation (no need to synchronize as different threads work on different object
instances) and data-hiding. The use of transient immutable value-objects minimizes side-effect
Comparing Java and C++, it is possible in C++ to implement similar functionality (for example, a
memory management model for specific classes can be designed in C++ to improve speed and lower
memory fragmentation considerably), with the possible cost of adding comparable runtime
overhead to that of Java's garbage collector, and of added development time and application
complexity if one favors manual implementation over using an existing third-party library. In Java,
garbage collection is built-in and virtually invisible to the developer. That is, developers may have no
notion of when garbage collection will take place as it may not necessarily correlate with any actions
being explicitly performed by the code they write. Depending on intended application, this can be
beneficial or disadvantageous: the programmer is freed from performing low-level tasks, but at the
same time loses the option of writing lower level code. Additionally, the garbage collection capability
demands some attention to tuning the JVM, as large heaps will cause apparently random stalls in
Java does not support pointer arithmetic as is supported in, for example, C++. This isbecause the
garbage collector may relocate referenced objects, invalidating such pointers. Another reason that
Java forbids this is that type safety and security can no longer be guaranteed if arbitrary
manipulation of pointers is allowed.

Java's performance has improved substantially since the early versions, and
performance of JIT compilers relative to native compilers has in some tests been shown to be quite
similar. The performance of the compilers does not necessarily indicate the performance of the
compiled code; only careful testing can reveal the true performance issues in any system.

Java Runtime Environment

The Java Runtime Environment, or JRE, is the software required to run any
application deployed on the Java Platform. End-users commonly use a JRE in software packages and
Web browser plugins. Sun also distributes a superset of the JRE called the Java 2 SDK (more
commonly known as the JDK), which includes development tools such as the Java compiler, Javadoc,
Jar and debugger.

One of the unique advantages of the concept of a runtime engine is that errors (exceptions) should
not 'crash' the system. Moreover, in runtime engine environments such as Java there exist tools that
attach to the runtime engine and every time that an exception of interest occurs they record
debugging information that existed in memory at the time the exception was thrown (stack and
heap values). These Automated Exception Handling tools provide 'root-cause' information for
exceptions in Java programs that run in production, testing or development environments.


Java Platform, Enterprise Edition (Java EE) builds on the solid foundation of Java Platform, Standard
Edition (Java SE) and is the industry standard for implementing enterprise-class service-oriented
architecture (SOA) and next-generation web applications. Java Platform, Enterprise Edition (Java EE)
is a set of coordinated technologies that significantly reduces the cost and complexity of developing,
deploying, and managing multitier, server-centric applications. Building on the Java Platform,
Standard Edition (Java SE), Java EE adds the capabilities that provide a complete, stable, secure, and
fast Java platform for the enterprise.

Java 2 Enterprise Edition (J2EE) technology is becoming a pervasive platform for the development
of Internet-based, transactional business applications. It provides a robust development platform
upon which to build flexible, reusable components and applications. It is a powerful standard that is
well-suited for Internet-based applications because it provides many of the underlying services such
as HTTP request processing (Java Servlet API), transaction management (Enterprise JavaBeans), and
messaging (Java Message Service), just to name a few. However, J2EE is also a complex and changing
standard that leaves the technologist with many design decisions and performance considerations.
Each component service adds a level of overhead to the application processing that must be
considered. Additionally, there are a number of common business logic functions, such as error
handling, that must be designed and de developed for each component and application. An
application development effort using J2EE should give careful consideration to the services provided
by the platform and how application components can best utilize them. There are a number of best
practices one should consider in order to be highly effective in building J2EE components and
integrating them into applications. These practices include evaluating and selecting the right set of
software components and services to do the job. This is no different than in other professions; a
carpenter or a steelworker both use an architecture plan to build things, although the tools they use
to do so are quite different. A scalable, modular architecture built upon J2EE will likely comprise a
selection of the appropriate set of J2EE services combined with a custom foundation of common
business logic functions.


Today more and more developments want to write distributed transactional applications for the
enterprise and leverage the speed, security and reliability of server side technology. J2EE is a
platform independent, java centric environment from sun for developing, building and deploying
web based enterprise application online. The J2EE platform consists of a set of services, API͛s and
protocols that provide functionality for developing multitiered web based application.

At the client side tier, J2EE supports pure HTML as well as java applets or applications. It relies on JSP
and Servlet codes to create HTML or other formatted data for the client. EJB provide another layer
where the platform͛s logic is stored. An EJB server provides functions such as threading,
concurrency, security and memory management. To reduce costs and fast-track enterprise
application design and development, the java2 platform, Enterprise edition (J2EE) technology
provides a component-based approach to the design, development, assembly and distributed
application model, the ability to reuse components, integrated Extensible Markup Language (XML)
based data interchange, a unified security model, and flexible transaction control.

The J2EE platform uses a multi tiered distributed application model. Application logic is
divided into components according to function, and the various application components that
make up a J2EE application are installed on different machines depending on the tier in the multi
tiered J2EE environment to which the application component belongs. The figure shown below
shows two multi tiered j2EE applications divided into the tiers described in the following list. The
J2EE application parts shown in Figure
Client-tier components run on the client machine.
Web-tier components run on the J2EE server.
Business-tier components run on the J2EE server. Enterprise information system (EIS)-
tier software runs the EIS server.

Application Client Dynamic HTML
JSP Pages
J2EE Application1 J2EE Application2
Client tier
Web Tier


J2EE applications are made up of components. A J2EE component is a self-contained
functional software unit that is assembled into a J2EE application with its related classes and files
and that following J2EE components: Application clients and applets are components that run on
the client.

Java Servlet and Java Server Pages (JSP) technology components are Web components
that run on the server.
Enterprise Java Beans (EJB) components are business components that run on the server.
J2EE components are written in the java programming language and are compiled in the same
way as any program in the language. The difference between J2EE components and standard
java classes is that J2EE components are assembled into a J2EE application. Verified to be well
formed and in compliance with managed by the J2EE server.


Normally, thin-client multi tiered applications are hard to write because they involve many
lines of intricate code to handle transaction and state management, multithreading, resource
pooling, and other complex low-level details. The component-based and platform-independent
J2EE architecture makes J2EE applications easy to write because business logic is organized into
reusable components. In addition, the J2EE server provides underlying services in the form of a
container for every component type. Because you do not have to develop these services
yourself, you are free to concentrate on solving the business problem at hand.
Containers provide the runtime support for J2EE application components.
Containers provide a federated view of the underlying J2EE APIs to the application components.
J2EE application components never interact directly with other J2EE application components.
They use the protocols and methods of the container for interacting with each other and with
platform services. Interposing a container between the application components and the J2EE
services allows the container to transparently inject the services defined by the components
deployment descriptors, such as declarative transaction management, security checks, resource
pooling, and state management. A typical J2EE product will provide a container for each
application component type: application client container, applet container, web component
container, and enterprise bean container.

Figure: J2EE Server and Containers


It is a runtime portion of a J2EE product. A J2EE server provides EJB and Web containers. The
component-based and platform-independent J2EE architecture makes J2EE applications easy to
write because business logic is organized into reusable components and the J2EE server provides
underlying services in the form of a container for every component type.

Components are installed in their containers during deployment and are the interface
between a component and the low-level platform-specific functionality that supports the
component. Before a web, enterprise bean, or application client component can be executed, it
must be assembled onto a J2EE application and deployed into its container. The assembly
process involves specifying container settings for each component in the J2EE application and for
the J2EE application itself. Container settings customize the underlying support provided by the
J2EE Server, which include services such as security, transaction management, Java Naming and
Directory Interface (JNDI) lookups, and remote connectivity. Here are some of the highlights:

client container
J2EE Server
JSP Page
Web Container
EJB Container
Client Machine
The J2EE security model lets you configure a web component or enterprise bean so
system resources are accessed only by authorized users.
The J2EE transaction model lets you specify relationships among methods that make up a
single transaction so all methods in one transaction are treated as a single unit.
JNDI lookup services provide a unified interface to multiple naming and directory
services in the enterprise so application components can access naming and directory
The J2EE remote connectivity model manages low-level communications between clients
and enterprise beans. After an enterprise bean is created, a client invokes methods on it as
if it were in the same virtual machine.


The J2EE platform also defines a number of distinct roles that are performed during the
application development and deployment life cycle:

The product provider designs and offers the J2EE platform, APIs, and other features that are
defined in the J2EE specification for purchase.
The tool provider offers tools that are used for the development and packaging of
application components as part of the J2EE specifications.
The application component provider creates Web components, enterprise beans, applets, or
application clients to use in J2EE applications.
The application assembler takes a set of components that are developed by component
providers and assembles them in the form of an enterprise archive (EAR) file.
The deployer is responsible for deploying an enterprise application into a specific
operational environment that corresponds to a J2EE platform product.
The system administrator is responsible for the operational environment in which the
application runs.

Product providers and tool providers have a product focus. Application component providers
and application assemblers focus on the application. Deployers and system administrators focus
on providing the J2EE application with platform-specific artifacts, and on the platform run time.

These roles help identify the tasks and people involved. Understanding this separation of
roles is important because it helps to determine the approach when developing and deploying
J2EE applications.


The J2EE specification provides customers a standard which can be used to ensure investment
protection when purchasing or developing applications. Comprehensive, independent Compatibility
Test Suites ensure vendor compliance with J2EE

Digital image processing focuses on two major tasks:
y Improvement of pictorial information for human interpretation.
y Processing of image data for storage, transmission and representation for autonomous
machine perception

Application Areas of Image Processing
1) Television
2) Signal Processing
3) Satellite Image Processing
4) Medical Image Processing
5) Robot Control
6) Visual Communications
7) LawEnforcement

Digital image processing has become a vast domain of modern signal technologies. Its
applications pass far beyond simple aesthetical considerations, and they include medical
imagery, television and multimedia signals, security, portable digital devices, video compression,
and even digital movies. We have been flying over some elementary notions in image processing
but there is yet a lot more to explore.
Pattern recognition is the research area that studies the operation and design of systems that
recognize patterns in data. It encloses subdisciplines like discriminant analysis, feature
extraction, error estimation, cluster analysis, grammatical inference and parsing. Important
application areas are image analysis, character recognition, speech analysis, man and machine
diagnostics, person identification and industrial inspection.
y Digital Image Processing 2nd Edition Rafael C. Gonzalez Richard E. Woods .
y Duda, Heart: Pattern Classification and Scene Analysis. J. Wiley & Sons, New York, 1982.
(2nd edition 2000).