Efficient Image Processing Algorithms on the Scan Line Array Processor
Image Processor
-
Upload
ashit-mittal -
Category
Engineering
-
view
142 -
download
2
description
Transcript of Image Processor
IMAGE PROCESSOR
TRAINING PROJECT REPORT
SUBMITTED IN THE PARTIAL FULFILLMENT OF THE COURSE CURRICULUM
OF
BECHELOR OF TECHNOLOGY
(COMPUTER SCIENCE & ENGINEERING)
SUBMITTED BY
YEAR: 2012
DEPARTMENT OF COMPUTER SCIENCE & ENGINEERING
SWAMI DEVI DYAL INSTITUTE OF ENGINEERING & TECHNOLOGY
BARWALA, PANCHKULA
1
ABSTRACT
The objective of the project is to design an Image Processor application whichenables the user to edit and enhanced image.
The project has been designed in Java technology and consists of java media frame work (JMF) and Java Advance Imaging(JAI).
My motivation for the project came from my enthusiasm and strong urge to J2SE andJAI which is one of the fastest growing technologies in today’s world.
Image processing in its broadest sense is an umbrella term for representing and analyzing of data in visual form. More narrowly, image processing is the manipulation of numeric data contained in a digital image for the purpose of enhancing its visual appearance.
Image processing software can also translate numeric information into visual images that
can be edited, enhanced, filtered, or animated in order to reveal relationships previously
not apparent.
“Image processing includes the steps involved in getting an image uploaded to a
computer, modifying, printing, and saving it as a digital image. Image processing
functions include resizing, sharpening, brightness, and contrast.”
Image processing is a rapidly evolving field with growing applications in science and
engineering. Image processing holds the possibility of developing the ultimate machine
that could perform the visual functions of all living beings. Digital image processing has
a broad spectrum of applications such as remote sensing via satellites, medical
processing, radar, sonar, and automated inspection of industrial parts.
The report contains the details of all the tasks carried out during the entire software development of the Image Processor. This document depicts all the details of the project.
2
Table of Contents
Abstract............................................................................................................................................ 9
PLATFORM………………………………................................................................................ 12Front End….………………………………................................................................................ 12History…….………………………………..............................................................................12-15Automatic memory management……………...........................................................................16-17
1. CHAPTER-1 INTRODUCTION…................................................................................................................ 182. CHAPTER-2 BACKGROUND.................................................................................................................... 192.1 Description of Existing System……….………………………………………………….…..192.2 Circumstances Leading to the Current New System………………………………..….…20-242.3 Objectives………………….................................................................................................. 24 Original Image…………………........................................................................................... 25 Negative…………………................................................................................................... .26 Change colour…………………............................................................................................27 Mean Filter………………….…………............................................................................... 28 Rotate……………………….…............................................................................................29 Image in Image………………….......................................................................................... 30 Median Filter…………………............................................................................................. 31 Black and White…………………........................................................................................ 32
3. Chapter 3 SYSTEM REQUIREMENT ANALYSIS............................................................................ 333.1 Information Gathering…….................................................................................................. 333.2 System Feasibility................................................................................................................. 333.2.1 Economical Feasibility………………...............................................................................343.2.2 Technical Feasibility..........................................................................................................343.2.2 Behavioural Feasibility...................................................................................................... 353.3 Technology used…………................................................................................................. 35
4. Chapter 4 SYSTEM ANALYSIS TOOL…………….......................................................................... 364.1 Class Diagram……………………...................................................................................... 36
5. CHAPTER 5 DESIGN……………......................................................................................................... 375.1 Interface Design……………………………………………………………………………37
6. Chapter 6 TESTING……………......................................................................................................... 38 6.1 Scope of Testing .................................................................................................................386.2 Test Plan..............................................................................................................................38 6.3 Test Case Design…….........................................................................................................39
3
6.4 Test Result...........................................................................................................................40 7. FUTURE SCOPE..................................................................................................................41
8. CONCLUSION.....................................................................................................................42
9. REFERENCE.......................................................................................................................43
4
PLATFORM
FRONT END:
Java SE:
Java is a programming language originally developed by James Gosling at Sun
Microsystems (which has since merged into Oracle Corporation) and released in 1995 as
a core component of Sun Microsystems' Java platform. The language derives much of its
syntax from C and C++ but has a simpler object model and fewer low-level facilities than
either C or C++. Java applications are typically compiled to bytecode (class file) that can
run on any Java Virtual Machine (JVM) regardless of computer architecture. Java is a
general-purpose, concurrent, class-based, object-oriented language that is specifically
designed to have as few implementation dependencies as possible. It is intended to let
application developers "write once, run anywhere" (WORA), meaning that code that runs
on one platform does not need to be recompiled to run on another. Java is as of 2012 one
of the most popular programming languages in use, particularly for client-server web
applications, with a reported 10 million users.
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 relicensed most of its Java
technologies 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.
History
James Gosling, Mike Sheridan, and Patrick Naughton initiated the Java language project
in June 1991. Java was originally designed for interactive television, but it was too
advanced for the digital cable television industry at the time. The language was initially
called Oak after an oak tree that stood outside Gosling's office; it went by the name
Green later, and was later renamed Java, from Java coffee, said to be consumed in large
5
quantities by the language's creators. Gosling aimed to implement a virtual machine and a
language that had a familiar C/C++ style of notation.
Sun Microsystems released the first public implementation as Java 1.0 in 1995. It
promised "Write Once, Run Anywhere" (WORA), providing no-cost run-times on
popular platforms. Fairly secure and featuring configurable security, it allowed network-
and file-access restrictions. Major web browsers soon incorporated the ability to run Java
applets within web pages, and Java quickly became popular. With the advent of Java 2
(released initially as J2SE 1.2 in December 1998–1999), new versions had multiple
configurations built for different types of platforms. For example, J2EE targeted
enterprise applications and the greatly stripped-down version J2ME for mobile
applications (Mobile Java). J2SE designated the Standard Edition. In 2006, for marketing
purposes, Sun renamed new J2 versions as Java EE, Java ME, and Java SE, respectively.
Java remains a de facto standard, controlled through the Java Community Process.
There are 930 million Java Runtime Environment downloads each year and 3 billion
mobile phones run Java.
Principles
There were five primary goals in the creation of the Java language:
1. It should be "simple, object-oriented and familiar"
2. It should be "robust and secure"
3. It should be "architecture-neutral and portable"
4. It should execute with "high performance"
5. It should be "interpreted, threaded, and dynamic"
Versions
Major release versions of Java, along with their release dates:
JDK 1.0 (January 23, 1996)
6
JDK 1.1 (February 19, 1997)
J2SE 1.2 (December 8, 1998)
J2SE 1.3 (May 8, 2000)
J2SE 1.4 (February 6, 2002)
J2SE 5.0 (September 30, 2004)
Java SE 6 (December 11, 2006)
Java SE 7 (July 28, 2011)
Java platform
One characteristic of Java is portability, which means that computer programs written in
the Java language must run similarly on any hardware/operating-system platform. This is
achieved by compiling the Java language code to an intermediate representation called
Java bytecode, instead of directly to platform-specific machine code. Java bytecode
instructions are analogous to machine code, but are intended to be interpreted by a virtual
machine (VM) written specifically for the host hardware. End-users commonly use a Java
Runtime Environment (JRE) installed on their own machine for standalone Java
applications, or in a Web browser for Java applets.
Standardized libraries provide a generic way to access host-specific features such as
graphics, threading, and networking.
A major benefit of using bytecode is porting. However, the overhead of interpretation
means that interpreted programs almost always run more slowly than programs compiled
to native executables would. Just-in-Time (JIT) compilers were introduced from an early
stage that compiles bytecodes to machine code during runtime.
Implementations
Oracle Corporation is the current owner of the official implementation of the Java SE
platform. This implementation is based on the original implementation of Java by Sun.
The Oracle implementation is available for Mac OS X, Windows and Solaris. Because
Java lacks any formal standardization recognized by Ecma International, ISO/IEC, ANSI,
7
or any other third-party standards organization, the Oracle implementation is the de facto
standard.
The Oracle implementations are packaged into two different distributions. The Java
Runtime Environment (JRE) which contains the parts of the Java SE platform required to
run Java programs. This package is intended for end-users. The Java Development Kit
(JDK), is intended for software developers and includes development tools such as the
Java compiler, Javadoc, Jar, and a debugger.
OpenJDK is another notable Java SE implementation that is licensed under the GPL. The
implementation started when Sun began releasing the Java source code under the GPL.
As of Java SE 7, OpenJDK is the official Java reference implementation.
The goal of Java is to make all implementations of Java compatible. Platform-
independent Java is essential to Java EE, and an even more rigorous validation is required
to certify an implementation. This environment enables portable server-side applications.
Performance
Programs written in Java have a reputation for being slower and requiring more memory
than those written in C. However, Java programs' execution speed improved significantly
with the introduction of Just-in-time compilation in 1997/1998 for Java 1.1 the addition
of language features supporting better code analysis (such as inner classes, the
StringBuffer class, optional assertions, etc.), and optimizations in the Java Virtual
Machine itself, such as HotSpot becoming the default for Sun's JVM in 2000. Currently
(February 2012), microbenchmarks show Java 7 is approximately 1.5 times slower than
C.
Some platforms offer direct hardware support for Java; there are microcontrollers that can
run Java in hardware instead of a software Java Virtual Machine, and ARM based
processors can have hardware support for executing Java bytecode through their Jazelle
option.
8
Automatic memory management
Java uses an automatic garbage collector to manage memory in the object lifecycle. The
programmer determines when objects are created, and the Java runtime is responsible for
recovering the memory once objects are no longer in use. Once no references to an object
remain, the unreachable memory becomes eligible to be freed automatically by the
garbage collector. Something similar to a memory leak may still occur if a programmer's
code holds a reference to an object that is no longer needed, typically when objects that
are no longer needed are stored in containers that are still in use. If methods for a
nonexistent object are called, a "null pointer exception" is thrown.
One of the ideas behind Java's automatic memory management model is that
programmers can be spared the burden of having to perform manual memory
management. In some languages, memory for the creation of objects is implicitly
allocated on the stack, or explicitly allocated and deallocated from the heap. In the latter
case the responsibility of managing memory resides with the programmer. If the program
does not deallocate an object, a memory leak occurs. If the program attempts to access or
deallocate memory that has already been deallocated, the result is undefined and difficult
to predict, and the program is likely to become unstable and/or crash. This can be
partially remedied by the use of smart pointers, but these add overhead and complexity.
Note that garbage collection does not prevent "logical" memory leaks, i.e. those where
the memory is still referenced but never used.
Garbage collection may happen at any time. Ideally, it will occur when a program is idle.
It is guaranteed to be triggered if there is insufficient free memory on the heap to allocate
a new object; this can cause a program to stall momentarily. Explicit memory
management is not possible in Java.
Java does not support C/C++ style pointer arithmetic, where object addresses and
unsigned integers (usually long integers) can be used interchangeably. This allows the
garbage collector to relocate referenced objects and ensures type safety and security.
9
As in C++ and some other object-oriented languages, variables of Java's primitive data
types are not objects. Values of primitive types are either stored directly in fields (for
objects) or on the stack (for methods) rather than on the heap, as commonly true for
objects (but see Escape analysis). This was a conscious decision by Java's designers for
performance reasons. Because of this, Java was not considered to be a pure object-
oriented programming language. However, as of Java 5.0, autoboxing enables
programmers to proceed as if primitive types were instances of their wrapper class.
Java contains multiple types of garbage collectors. By default, HotSpot uses the
Concurrent Mark Sweep collector, also known as the CMS Garbage Collector. However,
there are also several other garbage collectors that can be used to manage the Heap. For
90% of applications in Java, the CMS Garbage Collector is good enough.
10
CHAPTER 1
Introduction
Image processing in its broadest sense is an umbrella term for representing and analyzing
of data in visual form. More narrowly, image processing is the manipulation of numeric
data contained in a digital image for the purpose of enhancing its visual appearance.
Through image processing, faded pictures can be enhanced, medical images clarified, and
satellite photographs calibrated. Image processing software can also translate numeric
information into visual images that can be edited, enhanced, filtered, or animated in order
to reveal relationships previously not apparent.
A technique in which the data from an image are digitized and various mathematical
operations are applied to the data, generally with a digital computer, in order to create an
enhanced image that is more useful or pleasing to a human observer, or to perform some
of the interpretation and recognition tasks usually performed by humans. Also known as
image processing.
“ Transformation of an input image into an output image with desired properties.”
“ Image processing includes the steps involved in getting an image uploaded to a
computer, modifying, printing, and saving it as a digital image. Image processing
functions include resizing, sharpening, brightness, and contrast.”
11
CHAPTER 2
Background
2.1 Description of Existing System:
Image processing is any form of signal processing for which the input is an image, such
as photographs or frames of video; the output of image processing can be either an image
or a set of characteristics or parameters related to the image. Most image-processing
techniques involve treating the image as a two-dimensional signal and applying standard
signal-processing techniques to it.Image processing usually refers to digital image
processing, but optical and analog image processing are also possible. This article is
about general techniques that apply to all of them.
Operation performed by exitsing system:
Digital compositing or optical compositing (combination of two or more images).
Used in film-making to make a "matte"
Interpolation, demosaicing, and recovery of a full image from a raw image format
using a Bayer filter (A Bayer filter mosaic is a color filter array (CFA) for
arranging RGB color filters on a square grid of photosensors)pattern
Image registration, the alignment of two or more images
Image differencing: The difference between two images is calculated by finding
the difference between each pixel in each image, and generating an image based
on the result.
Morphing : Morphing is a special effect in motion pictures and animations that
changes (or morphs) one image into another through a seamless transition
12
2.2 Circumstances Leading to the Current New System:
In new system, take imge as input directly and performed various operation on it.This
operation includes:-
1. Gray Scale: Grayscale work on 8-bit representation.8-bit grayscale contain 256
shades of grey i.e. 28 =256(0-255) with 0 denoting Black color & 255 denoting
white color with other values representing intermediate shades of gray.
2. Negative Image: A negative image is a tonal inversion of positive image,in
which light areas appear dark and vice versa.
3. Brightness: Brightness as an attribute of a visual sensation according to which a
given visual stimulus appears to be more or less intense; or, according to which
the area in which the visual stimulus is presented appears to emit more or less
light.
4. Change Color: RGB values encoded in 24 bits per pixel are specified using three
8-bit unsigned integers (0 through 255) representing the intensities of red, green,
and blue. This representation is the current mainstream standard representation for
the so-called true color and common color interchange in image file formats such
as JPEG or TIFF. It allows more than 16 million different combinations (hence
the term millions of colors some systems use for this mode), many of them
indistinguishable to the human eye.
The following table shows the combination of RGB color:
13
5. Change Scale: Image processing in resize images in process often called image
scaling,making them larger or smaller.
6. Rotation: Image editors are capable of altering an image to be rotated in any
direction and to any degree. A small rotation of several degree is often enough to
level the horizon, correct vertically or both.Roteted image usually required
croppind outward,in order to remove the resulting gaps at the image edges.
7. Mean Filter: The Average (mean) filter smooths image data, thus eliminating
noise. This filter performs spatial filtering on each individual pixel in an image
using the grey level values in a square or rectangular window surrounding each
pixel.
R G B Color
0 0 0 Black
255 255 255 White
255 0 0 Red
0 255 0 Green
0 0 255 Blue
255 255 0 Yellow
0 255 255 Cyan
255 0 255 Magenta
14
For example:
a1 a2 a3
a4 a5 a6 3x3 filter window
a7 a8 a9
The average filter computes the sum of all pixels in the filter window and then divides the
sum by the number of pixels in the filter window:
Filtered pixel = (a1 + a2 + a3 + a4 ... + a9) / 9
8. Median Filter: In image processing it is usually necessary to perform a high
degree of noise reduction in an image before performing higher-level processing
steps.The median filter is a non-linear digital filtering technique, often used to
remove noise from images or other signals.
Median filtering is a common step in image processing. It is particularly useful to
reduce speckle noise and salt and pepper noise. Its edge-preserving nature makes it useful
in cases where edge blurring is undesirable.
Algorithm steps:,
The idea is to calculate the median of neighbouring pixels values. This can be done by
repeating these steps for each pixel in the image.
1. Store the neighbouring pixels in an array. The neighbouring pixels can be chosen
by any kind of shape, for example a box or a cross. The array is called the
window, and it should be odd sized.
2. Sort the window in numerical order
15
3. Pick the median from the window as the pixels value.
To demonstrate, the median filter will be applied to the following array with a window
size of 3, repeating edge values:
x = [2 80 6 3]
y[1] = Median [2 2 80] = 2
y[2] = Median [2 80 6] = Median[2 6 80] = 6
y[3] = Median [80 6 3] = Median[3 6 80] = 6
y[4] = Median [6 3 3] = Median[3 3 6] = 3
So, y = [2 6 6 3]
where y is the median filtered output of x.
9. Image in Image: This application are capable of merging one or more individual
images into a single file.
2.3 Objective:-
Image processing includes the steps involved in getting an image uploaded to a
computer, modifying, printing, and saving it as a digital image. Image processing
functions include resizing, sharpening, brightness, and contrast.
16
ORIGINAL IMAGE
17
NEGATIVE IMAGE
18
CHANGE COLOUR
19
MEAN FILTER
20
ROTATE
21
IMAGE IN IMAGE
22
MEDIAN FILTER
23
BLACK AND WHITE
24
CHAPTER 3
System requirement analysis
3.1: Information gathering:
Information Gathering is an art and science .Whether the trust of the activities is the
initial investigation or a feasibility study.
3.2 System feasibility:-
Study of requirement analysis is done through different feasibility studies. Following are
different feasibility studies.
1) Technical Feasibility
2) Economical Feasibility
3) Behavioral Feasibility
3.2.1 Economic Feasibility:
Among the most important information contained in feasibility study is cost benefit
analysis -an assessment of the economic justification for computer based system project.
Cost benefit analysis delineates cost for project developement and weights them against
tangible and intangible benefits of a system.. Benefits of a new system were determined
relative to existing system. So our system is economically feasible
25
3.2.2 Technical Feasibility:
During technical analysis, the analyst evaluates the technical merits of the system
concept,while at the collecting additional information about performance,
reliability,maintainability and reducibility ,technical analysis begins with an asessment of
the technical viability of the proposed system,it is analysed what kind of development
environment is required.Technical feasibility centers on the existing computer system
hardware,software etc and to what extend it can support the proposed addition.We are
working with technologies that are already available so this project is technically feasible
also.
C Vieweractive:intwinNum:intp:PanelDrwpath:StringsetOldImage():voidnewApply():voidmouseEntered(in e:MouseEvent):void
C Image Processingallimages : vectorwinNumber : intcurrentWin : intisToolsWinActive : intisInfoWinActive : intwhoOperationActive : intinfoX : intinfoY : intopenFrameCount : inttxtX : jTextFieldtxtY : jTextFieldlbtxtcurd : jLabellbtxtwin : jLabellbrotX : jLabellbrotY : jLabelfromX1 : jLabelfromX2 : jLabelfromY1 : jLabelfromY2 : jLabelRGBr : intRGBg : intRGBb : int
C RGBR:intG:intB:intp1 :JpanelredScroll :JScrollBar<<create>>RGB()
26
3.2.3 Behavioral Feasibility:
Our project will provide user friendly environment to the users for editing and enhancing
the images.So, our project is behavioral Feasibile also.
3.3 Technology used:-
Front end:- Java(Swings) Java Media Framework(JMF) Java Advance Imaging(JAI) Editor :- Netbeans7.1 Beta
27
CHAPTER 4
System analysis tool
4.1 class diagram:
C PanelDrwpantimg:BufferedImage<<create>>PanelDrw(in g2:BufferedImage)paint(in g:Graphics):voidrepaintPanelImage(in g3: BufferedImage):void
C HelplbInfo :Jlabelprev :JButtonnext :JButton<<create>>Help()
<create>Image Processing(int str : String)getAlpha(int p : int) : intgetRed(int p : int) : intgetGreen(int p : int) : intgetBlue(int p : int) : intseeColor ( in c : String):StringgetNumber(in c : int,int ch:String,in number:String) :intmeanValue(in a:int[]):intmedianValue(in a:int[]):intnot(in image1:BufferedImage): BufferedImage
C PhotoshopJMBar:JMenuBarJMfile:JMenuJMedit:JMenuJMscale:JMenuItemJMrotate: JMenuItemToolsPanel:JToolBardesktop:JDesktopPaneJBbrighten:JButtonJBrotate:JButtonJSgrayScale:JScrollBarlbr:JLabelTools:JInternalFrameComponentint():voidresetOldImage():voidClosedImage():voidHelp():voidFileChoose():String
C About<<create>>About()
28
CHAPTER 5 Design
5.1 Interface design:
29
CHAPTER 6
Testing
6.1 Scope of Testing:
The scope of testing is the extensiveness of the test process. A narrow scope may
be limited to determining whether or not the software specifications were correctly
implemented.
6.2 Test Plan:
A test plan is general document for the entire project that defines the scope, approach to
be taken and the schedule of testing as well as identifies the test item for the entire testing
process.
The input for test process:-
1. Project Plan
2. Requirements Document
3. System Design Document
A test plan should contain the following:-
Test unit specification
Feature to be tested
Approach for testing
Test deliverable
Schedule
Personal allocation
30
6.3 Test case design:-
Software testing is a critical element of software quality assurance and represent the
ultimate review of specification, design and coding. Testing is a process of executing a
program with the intent of finding an error. The various form of testing include:-
White box testing:-
White box testing is test case design method that uses the control structure of procedural
design to derive test cases. Using white box testing methods, the software engineer can
derive cases that:
1. Guarantee that all independent paths within a module level have been exercised atleast
once.
2. Exercise all logical decisions on their true or false sides.
3. Exercise all loops at their boundaries & within their operational bounds.
4. Exercise internal data structure to assure their validity.
Black box testing:-
It focuses on the functional requirements of the software. Black box testing attempt to
find error in the following categories:-
1. Incorrect or missing functions
2. Interface errors
3. Errors in data structures or external database access.
4. Performance error.
5. Initialization and termination error.
Alpha & Beta testing:-
31
It is virtually impossible for software developer to foresee how the customer will really
use a program. When customer software is built for one customer of a series of
acceptance test is conducted to enables the customer to validate all requirements.
A customer conducts the alpha test at developer side. Alpha test were performed at our
development side. Error and usage problems were noted and code was updated to remove
all of them.
The beta test is conducted at one or more customer sides by the end user of the software.
The beta testing of our system is not performed fully, as the product is not yet fully
deploy completely at the user’s site.
6.4 Test Results:-
After applying alpha and beta test, we have observed that the system is working fine and
all functional requirements are satisfied but interface need to be improved.
32
Future Scope
In future we implements all above written points in limitation of our application and
through this we enhance the capability of processing the images more precisely.
Image processing is a rapidly evolving field with growing applications in science and
engineering. Image processing holds the possibility of developing the ultimate machine
that could perform the visual functions of all living beings. Digital image processing has
a broad spectrum of applications such as remote sensing via satellites, medical
processing, radar, sonar, and automated inspection of industrial parts.
33
Conclusion
This report has detailed the development and implementation of an algorithm to detect
visual code markers in images taken from cell phone cameras. System where the process
of applying to image data for a given purpose is used for e.g. of operations include
scene analysis, image restoration, image enhancement, image processing, quantizing,
spatial filtering, and construction of two & three dimensional models of objects,
synonymous with picture processing
34
REFERENCE
We refer from:
http://en.wikipedia.org/wiki/Java
http://www.oracle.com/us/technologies/java/standard-edition/overview/
index.html
Javadocs J2se6
http://en.wikipedia.org/wiki/Image_processing
35