Documente Academic
Documente Profesional
Documente Cultură
CHAPTER - 1
Introduction
Filters are one of digital image enhancement technique used to sharp the image
and to reduce the noise in the image. There are two types of enhancement techniques
called Spatial domain and Frequency domain techniques which are categorized again
for smoothing and sharpening the images.
1.2 Challenges
One the major problem face during the development the project was to take the
random input from the system and then converting the inputed mage into the binary
image to apply the operation. Another problem which arrived during the development 63
the project was to save the changed image on to the systems. Digital image is
composed of 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.
Smoothing filters are used for blurring and for noise reduction.
63
CHAPTER - 2
System Analysis and Timeline
2.1System Analysis 63
The system as the capability to investigate the crime scene by applying various
image enhancement operations. The system takes image as input directly and
performed various operation on it. This operation includes:-
Gray Scale: Gray scale work on 8-bit representation.8-bit gray scale contain
256 shades of grey i.e. 28 =256(0-255) with 0 denoting Black colour & 255
denoting white colour with other values representing intermediate shades of
gray.
An image may be defined as a two dimensional function f(x,y), where x and y are
spatial(plane) coordinates and amplitude of 'f' at any pair of coordinates (x,y) is called
the intensity or gray level of the image at that point. When x,y are the amplitude
values of f are all finite, discrete quantities, then the image is a "digital image". The
field of digitial image processing refers to processing digital images by means of a
digital computer. Image processing is a general term for the wide range of techniques
that exits for manipulating and modifying images in various ways.
63
Display
Digital Online
[Department of Computer Science & Engineering] [ Ideal Institute of Technology, Ghaziabad] |
Buffer
Record
Image Enhancement System 201
6
% of Time
Process
Planning the project 5%
Testing 10%
Modules Completed
CHAPTER - 3
Feasibility Study
Once the problem is clearly understood, the next step is to conduct feasibility
study, which is high-level capsule version of the entered systems and design process.
The objective is to determine whether or not the proposed system is feasible. The
following three tests of feasibility have been carried out in the system-
Technical Feasibility.
Economical Feasibility.
Operational Feasibility.
Technical Feasibility:
In Technical Feasibility study, one has to test whether the proposed system can be
developed using existing technology or not. It is planned to implement the proposed
system using java technology. It is evident that the necessary hardware and software 63
are available for development and implementation of the proposed system. Hence, the
solution is technically feasible.
Economical Feasibility:
As part of this, the costs and benefits associated with the proposed system
compared and the project is economically feasible only if tangible or intangible
benefits outweigh costs. The system development costs will be significant. So the
proposed system is economically feasible.
Operational Feasibility:
It is a standard that ensures interoperability without stifling competition and
innovation among users, to the benefit of the public both in terms of cost and service
quality. The proposed system is acceptable to users. So the proposed system is
operationally feasible.
CHAPTER - 4
Literature Survey
Image Processing
An image defined in the “real world” is considered to be a function of two real
variables, for example, a(x,y) with a as the amplitude (e.g. brightness) of the image at
the real coordinate position (x,y). In a sophisticated image processing system it should
be possible to apply specific image processing operations to selected regions. Thus
one part of an image (region) might be processed to suppress motion blur while
another part might be processed to improve color rendition. Modern digital 63
4.2Front End
For software applications, front-end is the same as user interface. Compilers, the
programs that translate source code into object code, are often composed of two parts:
a front-end and a back-end. The front-end is responsible for syntax checking and
detecting errors, whereas the back-end performs the actual translation into object
code. Here we use “Java Technology” as the front-end of the project. The brief
description of the technology is discussed below.
programming language with excellent security, but you need to be aware of the
tradeoffs.’
API. Only those class files from the Java API that are actually needed by a running
program are loaded into the virtual machine. The byte codes are executed in an
execution engine.
Java with its versatility, efficiency, and portability, Java has become
invaluable to developers by enabling:
“Write software on one platform and run it on virtually any other
platform. Create programs to run within a Web browser and Web services.”
4.3Back End
Front-end and back -end are terms used to characterize program interfaces and
63
services relative to the initial user of these interfaces and services.(The "user" may be
4.4NetBeans IDE 63
The NetBeans IDE is an award-winning integrated development environment
available for Windows, Mac, Linux, and Solaris. The NetBeans project consists of
an open-source IDE and an application platform that enable developers to rapidly
create web, enterprise, desktop, and mobile applications using the Java platform, as
well as PHP, JavaScript and Ajax, Groovy and Grails, and C/C++.The NetBeans
project is supported by a vibrant developer community and offers
extensive documentation and training resources as well as a diverse selection of third-
party plug-ins.
NetBeans IDE 7.1 introduced support for JavaFX 2.0 and NetBeans IDE 7.1.2
introduces support for JavaFX 2.1 by enabling the full compile/debug/profile
development cycle for JavaFX 2.1 applications. The release also provides significant
Swing GUI Builder enhancements, CSS3 support, and tools for visual debugging of
Swing and JavaFX user interfaces. Additional highlights include Git support
integrated into the IDE, new PHP debugging features, various JavaEE and Maven
improvements, and more.
NetBeans IDE 7.1 is available in English, Brazilian Portuguese, Japanese, Russian
and Simplified Chinese
CHAPTER - 5
Implementation and System Requirements
5.1 Implementation
An image defined in the “real world” is considered to be a function of two real
variables, for example, a(x, y) with a as the amplitude (e.g. brightness) of the image at
the real coordinate position (x, y). In a sophisticated image processing system it
should be possible to apply specific image processing operations to selected regions. 63
Thus one part of an image (region) might be processed to suppress motion blur while
Software Environment
Hardware Environment
RAM : 64 MB
Harddisk : 2.1GB
CHAPTER - 6
Filtering Techniques
Image enhancement approaches fall into two broad categories. Spatial domain
methods- Refers to the image plane itself and approaches in the category are based on
direct manipulation of pixels in an image.
The Canny edge detector is still a state-of-the-art edge detector. Unless the
preconditions are particularly suitable, it is hard to find an edge detector that performs
significantly better than the Canny edge detector.
6.3 FILERTING
Filtering is one of the Image Enhancement Techniques used for sharpening and
smoothening the image thereby removing the noise from it.
A high-pass filter can be used to make an image appear sharper. These filters
emphasize fine details in the image – exactly the opposite of the low-pass filter. High-
pass filtering works in exactly the same way as low-pass filtering; it just uses a
different convolution kernel. In the example below, notice the minus signs for the
adjacent pixels. If there is no change in intensity, nothing happens. But if one pixel is
brighter than its immediate neighbors, it gets boosted.
0 -1/4 0
63
- +2 -1/4
1/4
0 -1/4 0
6.4 SHARPENING
Sharpening of digital image files is one of the most important aspects of image
quality and arguably one of the least understood. Sharpening brings out detail and
gives an image presence, but not all images should be sharpened the same and even
areas within an image often need a specific sharpening treatment.
6.6 THRESHOLDING
Image thresholding is a simple, yet effective, way of partitioning an image into a
foreground and background
The simplest thresholding methods replace each pixel in an image with a black
pixel if the image intensity is less than some fixed constant T (that is, ),
or a white pixel if the image intensity is greater than that constant.
6.7 NEGATIVE
A negative is an image, is a technique in which the lightest areas of the
photographed subject appear darkest and the darkest areas appear lightest.
63
CHAPTER - 7
System Design with Data Flow Diagram
Image
User enhancemen User
t techniques
Exit
Menus File
[Department of Computer Science & Engineering] [ Ideal Institute of Technology, Ghaziabad] User
|
User Ope Imag
n e
Image Enhancement System 201
6
The File contains two options Open to select an image and Exit to come out from
the window.
Negate
Rotate
Image
User Gray User
Scale
Contras
t
Histogra
m
Fig. 7.3 Second Level Diagram
The Image Menu contains operations of enhancements such as Negate the image,
rotate the image, Gray Scale image, perform Contrast Stretching and finally
Histogram Techniques
63
CHAPTER - 8
Code and Implementation
if(filename!=null)
{
src=Toolkit.getDefaultToolkit().getImage(filename);
MediaTracker mt=new MediaTracker(this);
mt.addImage(src,0);
try
{
mt.waitForID(0);
}catch(Exception e)
{
System.out.println("Image Loading Error!"+e);
System.exit(0);
}
dst=src;
repaint();
}
}
public void addNotify()
{
super.addNotify();
insets=getInsets();
setBounds(50,50,500+insets.left,350+insets.top);
}
public void open()
{
FileDialog fd=new FileDialog(this,"Open",FileDialog.LOAD);
fd.setVisible(true);
String dir=fd.getDirectory();
String fname=fd.getFile();
filename=dir+fname;
abc();
}
public void org()
{
if(filename!=null)
{
dst=src;
repaint();
}
}
public void cs()
{
if(filename!=null)
{
int iw,ih;
int j1,j2,j3,j4;
int pixels[];
int out[];
int errflag=0; 63
iw=dst.getWidth(null);
ih=dst.getHeight(null);
pixels=new int[iw*ih];
try
{
PixelGrabber pg=new PixelGrabber(dst,0,0,iw,ih,pixels,0,iw);
pg.grabPixels();
}catch(InterruptedException e){};
mydialog md=new mydialog(this,"Contrast Stretching",true,2);
md.setSize(250,180);
md.setVisible(true);
if((md.val1!=null)&&(md.val2!=null)&&(md.val3!=null)&&(md.val4!=null))
{
j1=Integer.parseInt(md.val1);
if((j1<0)||(j1>255))
errflag=1;
j2=Integer.parseInt(md.val2);
if((j2<0)||(j2>255))
errflag=1;
j3=Integer.parseInt(md.val3);
if((j3<0)||(j3>255))
errflag=1;
j4=Integer.parseInt(md.val4);
if((j4<0)||(j4>255))
errflag=1;
if(errflag==0)
{
contrast c=new contrast(j1,j2,j3,j4);
out=c.csimage(pixels,iw,ih);
dst=createImage(new MemoryImageSource(iw,ih,out,0,iw));
}
else
{
errdialog ed=new errdialog(this,"Error!",true);
ed.setSize(200,100);
ed.setVisible(true);
}
}
repaint();
}
}
public void lp()
{
if(filename!=null)
{
int[ ] filter={1,1,1,
1,1,1,
1,1,1};
double multiplier=0.11111;
convfilter cv=new convfilter(filter); 63
filtered=cv.filteredImage(dst,multiplier);
dst=createImage(filtered);
repaint();
}
}
public void hp()
{
if(filename!=null)
{
int[ ] filter={-1,-1,-1,
-1,8,-1,
-1,-1,-1};
double multiplier=1;
convfilter cv=new convfilter(filter);
filtered=cv.filteredImage(dst,multiplier);
dst=createImage(filtered);
repaint();
}
}
public void hb()
{
if(filename!=null)
{
int[] filter={-1,-1,-1,
-1,9,-1,
-1,-1,-1};
double multiplier=1;
convfilter cv=new convfilter(filter);
filtered=cv.filteredImage(dst,multiplier);
dst=createImage(filtered);
repaint();
}
}
public void hist()
{
if(filename!=null)
{
int iw,ih;
int pixels[];
int out[];
iw=dst.getWidth(null);
ih=dst.getHeight(null);
pixels=new int[iw*ih];
try
{
PixelGrabber pg=new PixelGrabber(dst,0,0,iw,ih,pixels,0,iw);
pg.grabPixels();
}catch(InterruptedException e){};
Histogram h=new Histogram(this,"Histogram");
h.set(pixels,iw,ih); 63
h.setSize(320,480);
h.setVisible(true);
}
}
public void thr()
{
if(filename!=null)
{
int iw,ih;
int pixels[];
int out[];
int j1;
iw=dst.getWidth(null);
ih=dst.getHeight(null);
pixels=new int[iw*ih];
try
{
PixelGrabber pg=new PixelGrabber(dst,0,0,iw,ih,pixels,0,iw);
pg.grabPixels();
}catch(InterruptedException e){};
mydialog md=new mydialog(this,"Thresholding",true,0);
md.setSize(200,130);
md.setVisible(true);
if(md.val1!=null)
{
j1=Integer.parseInt(md.val1);
if((j1<0)||(j1>255))
{
errdialog ed=new errdialog(this,"Error!",true);
ed.setSize(200,100);
ed.setVisible(true);
}
else
{
thresholding level=new thresholding(j1);
out=level.tsimage(pixels,iw,ih);
dst=createImage(new MemoryImageSource(iw,ih,out,0,iw));
}
}
repaint();
}
}
public void heq()
{
if(filename!=null)
{
int iw,ih;
int pixels[];
int out[]; 63
iw=dst.getWidth(null);
ih=dst.getHeight(null);
pixels=new int[iw*ih];
try
{
PixelGrabber pg=new PixelGrabber(dst,0,0,iw,ih,pixels,0,iw);
pg.grabPixels();
}catch(InterruptedException e){};
he heq=new he();
out=heq.equalize(pixels,iw,ih);
dst=createImage(new MemoryImageSource(iw,ih,out,0,iw));
repaint();
}
}
public void neg()
{
if(filename!=null)
{
int iw,ih;
int pixels[];
int out[];
iw=dst.getWidth(null);
ih=dst.getHeight(null);
pixels=new int[iw*ih];
try
{
}catch(InterruptedException e){};
grey g=new grey();
out=g.greyimage(pixels,iw,ih);
dst=createImage(new MemoryImageSource(iw,ih,out,0,iw));
repaint();
}
}
}
if((r>r1)&&(r<r2))
r=(int)(slp2*(r-r1)+s1);
else
63
if((r>=r2)&&(r<=255))
r=(int)(slp3*(r-r2)+s2);
int g=0xff&(p>>8);
if((g>=0)&&(g<=r1))
g=(int)(slp1*g);
else
if((g>r1)&&(g<r2))
g=(int)(slp2*(g-r1)+s1);
else
if((g>=r2)&&(g<=255))
g=(int)(slp3*(g-r2)+s2);
int b=0xff&(p);
if((b>=0)&&(b<=r1))
b=(int)(slp1*b);
else
if((b>r1)&&(b<r2))
b=(int)(slp2*(b-r1)+s1);
else
if((b>=r2)&&(b<=255))
b=(int)(slp3*(b-r2)+s2);
outpixels[i]=(255<<24)|(r<<16)|(g<<8)|b;
}
return outpixels;
}
}
8.2.3 FILTERIN
Filtering is one of the Image Enhancement Techniques used for sharpening and
smoothening the image thereby removing the noise from it. It is done by removing the
noise of the image, by applying the low pass filter for smoothing or high pass filter for
sharpening the image.
w01=matrix[1];
w02=matrix[2];
w10=matrix[3];
w11=matrix[4];
w12=matrix[5];
w20=matrix[6];
w21=matrix[7];
w22=matrix[8];
}
public boolean imageUpdate(Image img,int infoflags,int x,int y,int width,int
height)
{
w=width;
h=height;
if(w!=-1&&h!=-1)
{
return false;
}
return true;
}
public ImageProducer filteredImage(Image source,double mult)
{
boolean success;
w=source.getWidth(null);
h=source.getHeight(null);
oldpixels=new int[w*h];
newpixels=new int[w*h];
pg=new PixelGrabber(source.getSource(),0,0,w,h,oldpixels,0,w);
try
{
success=pg.grabPixels(0);
}catch(Exception e)
{
System.out.println("Error in grabbing"+e);
}
index=w+1;
for(int y=1;y<h-1;y++)
{
calc3x3offsets();
for(int x=1;x<w-1;x++)
{
p00=oldpixels[i00];
p01=oldpixels[i01];
p02=oldpixels[i02];
p10=oldpixels[i10];
p11=oldpixels[i11];
p12=oldpixels[i12];
p20=oldpixels[i20];
63
p21=oldpixels[i21];
p22=oldpixels[i22];
int newRed=applyWeights(16,mult);
int newGreen=applyWeights(8,mult);
int newBlue=applyWeights(0,mult);
newpixels[index++]=255<<24|newRed|newGreen|newBlue;
i00++;
i01++;
i02++;
i10++;
i11++;
i12++;
i20++;
i21++;
i22++;
}
index+=2;
}
mis=new MemoryImageSource(w,h,newpixels,0,w);
return mis;
}
final void calc3x3offsets()
{
i00=index-w-1;
i01=i00+1;
i02=i00+2;
i10=index-1;
i11=index;
i12=index+1;
i20=index+w-1;
i21=i20+1;
i22=i20+2;
}
final int applyWeights(int shift,double multfactor)
{
double total=0;
total+=((p00>>shift)&0xFF)*w00;
total+=((p01>>shift)&0xFF)*w01;
total+=((p02>>shift)&0xFF)*w02;
total+=((p10>>shift)&0xFF)*w10;
total+=((p11>>shift)&0xFF)*w11;
total+=((p12>>shift)&0xFF)*w12;
total+=((p20>>shift)&0xFF)*w20;
total+=((p21>>shift)&0xFF)*w21;
total+=((p22>>shift)&0xFF)*w22;
total=total*multfactor;
if(total>255)
total=255;
if(total<0)
total=0; 63
return((int)total)<<shift;
}
}
8.2.4 HISTOGRAM
The histogram of a digital image with gray levels in the range[0,L-1] is a
discrete function. The probability of a gray level is the ratio of number of pixels at
that gray level to the total number of pixels.
if(result<0)
result=0;
dest[i]=0xff000000|(result+(result<<16)+(result<<8));
}
return dest;
}
}
else
b=vs3;
outpixels[i]=(255<<24)|(r<<16)|(g<<8)|b;
}
return outpixels;
}
}
8.2.7 NEGATIVE
Negatives of digital images are useful in numerous applications, such as
displaying medical images and photographing a screen with monochrome positive
film with the idea of using the resulting negatives as normal slides. A negative image
can be obtained by reverse scaling of the gray level.
int r=0xff&(p>>16);
r=(int)255-r;
int g=0xff&(p>>8);
g=(int)255-g;
int b=0xff&(p);
b=(int)255-b;
outpixels[i]=(255<<24)|(r<<16)|(g<<8)|b;
}
return outpixels;
}
}
8.2.8 THRESHOLDING
Colour images can also be thresholded. One approach is to designate a separate
threshold for each of the RGB components of the image and then combine them with 63
an AND operation. This reflects the way the camera works and how the data is
stored in the computer, but it does not correspond to the way that people recognize
colour
the preconditions are particularly suitable, it is hard to find an edge detector that
performs significantly better than the Canny edge detector.
}
}
{Toolkit tk=Toolkit.getDefaultToolkit();
MenuItem op,cls;
MenuItem org,neg,ls,lp,hp,hb,hist,thr,gs,cs,rot,heq,ed,sv;
public myframe()
{
super("Image Enhancement");
JButton b1 = new JButton("OPEN");
b1.setBounds(600, 650, 150, 60);
add(b1);
setSize(150, 60);
setLayout(null);
setVisible(true);
b1.addActionListener(this);
b1.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
open();
throw new UnsupportedOperationException("Not supported yet."); //To
change body of generated methods, choose Tools | Templates.
}
});
dispose();
System.exit(0);
b9.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
hb();
throw new UnsupportedOperationException("Not supported yet."); //To
change body of generated methods, choose Tools | Templates.
}
});
if(source.getLabel().equals("open")){
open();}
else if (source.getLabel().equals("neg")){
neg();
}
else if (source.getLabel().equals("Grey Scale")){
gs();
}
else if (source.getLabel().equals("Rotate")){
rotate();
}
else if (source.getLabel().equals("Level Slicing")){
ls();
}
else if (source.getLabel().equals("Low Pass Filter")){
lp();
}
else if (source.getLabel().equals("Original")){
org();
}
else if (source.getLabel().equals("High Pass Filter")){
hp();
}
else if (source.getLabel().equals("Sharpen")){
hb();
}
else if (source.getLabel().equals("Histogram")){
hist();
}
else if (source.getLabel().equals("Thresholding")){
thr();
}
else if (source.getLabel().equals("Constrast Stretching")){
cs();
}
else if (source.getLabel().equals("Histogram Equalizing")){
heq();
}
else if (source.getLabel().equals("Edge Detect")){
ed();
} 63
else if (source.getLabel().equals("Edge Detect")){
save();
}
else if (source.getLabel().equals("Exit")){
dispose();
System.exit(0);
}
}
63
CHAPTER - 9
PROJECT SCREEN SHOTS
9.1 PROJECT U I
63
9.6 HISTOGRAM
63
63
CHAPTER - 10
10.1 Conclusion
The objective of the project is to smooth and sharp the images by using various
Filtering techniques. Where Filtering techniques are on of the enhancement
techniques in the Digital image processing. 63
Here in the project I had implemented few spatial domain filters and frequency
domain filters. Where spatial domain filters removes the noise and blurs the image.
And frequency domain filters are used to sharpen the inside details of an image.
Filters are useful in many application areas as medical diagnosis, Army and Industrial
areas.
Research Publication
Pulak Mehrotra1, Shubham Gupta 2, Dr. Sudhir Dawra 3, and Mr. Amit Kumar Jaiswal4
1, 2
Research Scholar at Ideal Institute of Technology, Ghaziabad
3, 4
Research Guide in Department of Computer Science and Engineering at
Ideal Institute of Technology, Ghaziabad
Abstract- Image enhancement is the way of applying some alterations to an input image to
obtain a more visually correct image. Image enhancement is used to improve the image
quality so that the resultant image is better than the original image for a specific application or
set of tasks. The transform domain enables operation on the frequency content of the image, 63
and therefore high frequency content such as edges and other hidden information can easily
be enhanced. However, these techniques bring about some changes in the images and can also
generate unwanted artifacts in many cases, as it is not possible to enhance all parts of the
image in balanced manner.
[4]S Jayaraman,S
Esakkirajan,T
Veerakima:Digital Image
Processing, Ed III, Tata
McGraw Hill Education
private limited, New Delhi.
References
[1.] http://www.sun.com
[2.] http://www.javalessons.com
[3.] http://www.javalobby.com
[4.] Volume 2, Issue 4, April 2012 ISSN: 2277 128X International Journal of
Advanced Research in Computer Science and Software Engineering.
[5.] International Journal of Advanced Research in Computer and
Communication Engineering Vol. 2, Issue 3, March 2013Various Image
Enhancement Techniques- A Critical Review
.
63