You are on page 1of 59

Image restoration using Lucy Richardson algorithm for X-ray images

Abstract

Digital images restoration from their degraded measurement has always been a problem
of great interest. A specific solution to the problem of image restoration is generally determined
by the nature of degradation phenomena. So it is highly dependent on the nature of the noise
present there. In this project Lucy Richardson algorithm (LRA) is implemented on the X-ray
image using Matlab and restoration is processes is observed. LRA is a non blind technique of
image restoration, used to restore a degraded image that has been degraded by a known PSF. It is
an iterative procedure in which the pixels of the observed image are represented using the PSF.
Image restoration is an emerging field of image processing in which the focus is on recovering
an original image from a degraded image. The degraded image can be a result of a known
degradation or unknown degradation. Hence image restoration can be defined as a process of
recovering a sharp image from a degraded image which is blurred by a degradation function,
commonly by a Point Spread Function (PSF). The Point Spread Function describes the response
of an imaging system to a point source or point object

Keywords: LRA, X ray images, Matlab, PSF.

Department of ECE Page 1 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

CHAPTER 1
INTRODUCTION
1. An Image:
An image refers to a 2D light intensity function f(x,y), where (x,y) denote spatial coordinates
and the value of f at any point (x,y) is proportional to the brightness or gray levels of the image
at that point. A digital image is an image f(x,y) that has been discretized both in spatial
coordinates and brightness. The elements of such a digital array are called image elements or
pixels.
A simple image model:
To be suitable for computer processing, an image f(x,y) must be digitalized both spatially and in
amplitude.Digitization of the spatial coordinates (x,y) is called image sampling.Amplitude
digitization is called gray-level quantization. The storage and processing requirements increase
rapidly with the spatial resolution and the number of gray levels.
1.1.Introduction of digital images processing:

Digital image processing deals with manipulation of digital images through a digital
computer. It is a subfield of signals and systems but focus particularly on images. DIP focuses on
developing a computer system that is able to perform processing on an image. The input of that
system is a digital image and the system process that image using efficient algorithms, and gives
an image as an output. The most common example is Adobe Photoshop. It is one of the widely
used application for processing digital images.

Figure: 1.1.An image has been captured by a camera and has been sent to a digital system

Department of ECE Page 2 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

In the above figure, an image has been captured by a camera and has been sent to a digital
system to remove all the other details, and just focus on the water drop by zooming it in such a
way that the quality of the image remains the same.

1.2. Problem outline:

Image restoration is the process of clearing the degraded image to obtain the original
image. The main aim of the work is to restore the blurred X-Ray image using Blind Image
Restoration. It is very important part of image restoration to recover image without the
knowledge of the reason of its degradation. At first, the original X-Ray image is degraded using
the Degradation Model. With the addition of blur we get the blurred X-Ray image.

X-ray imaging is the fastest and easiest way for a physician to view and assess broken bones,
cracked skull and an injured spine. Images of the injury can show very fine hairline fractures or
chips, while images produced after treatment ensure a fracture has been properly aligned and
stabilised for healing.

X-rays play a key role in orthopaedic surgery such as spinal repair, joint replacements or fracture
reductions. Bone x-rays are an essential tool in the treatment of many sports injuries. X-rays can
be useful in detecting advanced forms of bone cancer, although very early detection of bone
cancer requires other methods such as Computerised Tomography (CT) or Magnetic Resonance
Imaging (MRI).

X-rays can be used to diagnose and monitor the progression of degenerative diseases such as
arthritis. Severe osteoporosis may be visible on x-rays, but bone densitometry is used to detect
early loss of bone density and is done on special equipment.as the doctor cant identify the
disease directly by analyzing the x-ray image inorder to identify the disease using x-ray image
we are going to use lucy Richardson algorithm.by using this algorithm we can easily identify the
disease.

1.3.Proposed work:

LRA stands for Lucy Richardson Algorithm which is used for image restoration. It is a
non blind technique of image restoration, used to restore a degraded image that has been

Department of ECE Page 3 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

degraded by a known PSF.The Lucy-Richardson Algorithm is a well-known iterative method for


the deconvolution of images convolved with a known point spread function. It is derived from a
statistical point of view as it converges to the maximum likelihood solution under the condition
that the data follow a Poisson distribution. This assumption holds true for images detected by a
digital camera. However, there are images not following a Poisson but rather a non central chi-
square distribution. Here an adaption of the Lucy- Richardson algorithm to be used for data
following this probability distribution is shown. Its application to simulated and real data from an
imaging radar sensor shows its various advantages of the original algorithm. Lucy Richardson is
a well known algorithm used for restoring the degraded images. It is used when knowledge about
the sources which have actually degraded the original image is known. It gives us an estimate of
the original image.

Department of ECE Page 4 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

CHAPTER 2
Back ground information
2.Introduction:
Flag preparing is a train in electrical building and in science that arrangements with investigation and
handling of simple and advanced flags and manages putting away , sifting and different operations on signs. These
signs incorporate transmission signals , sound or voice signals , picture signals,and different signs e.t.c.
Out of every one of these signs , the field that arrangements with the kind of signs for which the info is a picture and
the yield is likewise a picture is done in picture handling. As it name proposes, it manages the preparing on images.It
can be further partitioned into simple picture handling and computerized picture preparing.

2.1.Analog image processing:


Simple picture handling is done on simple signs. It incorporates preparing on two
dimensional simple signs. In this kind of handling, the pictures are controlled by electrical
means by differing the electrical flag. The basic case incorporate is the TV image.Digital picture
handling has ruled over simple picture preparing with the progression of time due its more
extensive scope of utilizations

2.2.Digital image processing:

The digital image processing deals with developing a digital system that performs
operations on a digital image.

2.2.1.Image:

An image is nothing more than a two dimensional signal. It is defined by the


mathematical function f(x,y) where x and y are the two co-ordinates horizontally and
vertically.The value of f(x,y) at any point is gives the pixel value at that point of an image.

Department of ECE Page 5 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure: 2.2.1.example of digital image


The above figure is an example of digital image that you are now viewing on your computer
screen. But actually, this image is nothing but a two dimensional array of numbers ranging
between 0 and 255.

128 30 123

232 123 321

123 77 89

80 255 255

Table: 2.2.1(a).A two dimensional array of numbers ranging between 0 and 255.

Each number represents the value of the function f(x,y) at any point. In this case the value 128 ,
230 ,123 each represents an individual pixel value. The dimensions of the picture is actually the
dimensions of this two dimensional array.

2.2.2. Relationship between a digital image and a signal:


If the image is a two dimensional array then what does it have to do with a signal? In
order to understand that , We need to first understand what is a signal?

Signal:

Department of ECE Page 6 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

In physical world, any amount quantifiable through time over space or any higher
measurement can be taken as a flag. A flag is a scientific capacity, and it passes on some
information.A flag can be one dimensional or two dimensional or higher dimensional flag. One
dimensional flag is a flag that is measured after some time. The regular case is a voice flag.
The two dimensional signs are those that are measured over some other physical amounts. The
case of two dimensional flag is a computerized picture. We will look in more detail in the
following instructional exercise of how a one dimensional or two dimensional single and higher
signs are shaped and translated.
Relationship:
Since anything that passes on data or communicate a message in physical world between
two eyewitnesses is a flag. That incorporates discourse or (human voice) or a picture as a flag.
Since when we talk, our voice is changed over to a sound wave/flag and changed as for the
opportunity to individual we are addressing. This , as well as the way a computerized camera
works, as while gaining a picture from an advanced camera includes exchange of a flag from
one a player in the framework to the next.

2.2.3. How a digital image is formed:


Since catching a picture from a camera is a physical procedure. The daylight is utilized
as a wellspring of vitality. A sensor exhibit is utilized for the procurement of the picture. So
when the daylight falls upon the question, then the measure of light reflected by that protest is
detected by the sensors, and a constant voltage flag is created by the measure of detected
information. To make a computerized image,we need to change over this information into an
advanced shape. This includes testing and quantization. (They are talked about later on). The
aftereffect of inspecting and quantization brings about a two dimensional cluster or framework
of numbers which are only an advanced picture.

Signal processing:

Signal processing is an umbrella and image processing lies under it. The amount of light
reflected by an object in the physical world (3d world) is pass through the lens of the camera and
it becomes a 2d signal and hence result in image formation. This image is then digitized using

Department of ECE Page 7 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

methods of signal processing and then this digital image is manipulated in digital image
processing.

2.3. IMAGE RESTORATION :


2.3.1. INTRODUCTION:
Picture rebuilding depends on the endeavor to enhance the nature of a picture through
learning of the physical procedure which prompted to its arrangement. The reason for picture
rebuilding is to "make up for" or "fix" surrenders which debase a picture. Debasement comes in
numerous structures, for example, movement obscure, clamor, and camera mis-center. In cases
like movement obscure, it is conceivable to think of a decent gauge of the real obscuring
capacity and "fix" the obscure to reestablish the first picture. In situations where the picture is
adulterated by clamor, the best we may would like to do is to adjust for the debasement it
brought on. Picture reclamation varies from picture upgrade in that the last is concerned more
with emphasis or extraction of picture elements as opposed to rebuilding of corruptions. Picture
reclamation issues can be measured exactly, while improvement criteria are hard to speak to
numerically.
Picture rebuilding began in 1950's. There are a few application space of picture rebuilding like
logical investigation, legitimate examinations, film making and archivals, picture and video
deciphering and customer photography. The principle region of use is picture reproduction in
radio space science, radar imaging and tomography.Image restoration uses a priori knowledge of
the degradation. It models the degradation and applies inverse process. It formulates and
evaluates the objective criteria of goodness. The distortion can be modeled as noise or a
degradation function. To restore an image from a noise model, different filters like median filter,
homomorphic filters are used. To get rid of periodic noises, butterworth low pass filter,
butterworth band reject filters and notch filters are used. To restore an image from linear
degradation, inverse and pseudo inverse filtering, wiener filtering and blind de-convolution are
used.
A simplified version for the image restoration process model is y (i, j ) = H{ [f (i, j )]} + n(i, j )
Where y (i, j )is the degraded image, f (i, j ) is the original image, H an operator that represents
the degradation process n(i, j ) the external noise which is assumed to be image independent

Department of ECE Page 8 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure: 2.3.1.Image degradation and restoration techniques

Restoration of digital images from their degraded measurement has always been a problem of
great interest. A specific solution to the problem of image restoration is generally determined by
the nature of degradation phenomena. So it is highly dependent on the nature of the
noise present there. Given the noise function, one can use the Richardson-Lucy Algorithm to
restore the degraded image. This algorithm was introduced by W.H. Richardson (1972) and L.B.
Lucy (1974).
An image is nothing but a huge collection of numbers known as pixels. In particular a gray
image is an image in which the value of each pixel is a single sample, that is it carries only
intensity information. So a pixel in a given image is just the intensity at that particular point. The
pixel value is a number between 0 and 1 (both inclusive). 0 denotes the total absence (i.e. black)
and 1 denotes the total presence (i.e. white).
Image restoration is based on the attempt to improve the quality of an image through knowledge
of the physical process which led to its formation. The purpose of image restoration is to
"compensate for" or "undo" defects which degrade an image. Degradation comes in many forms
such as motion blur, noise, and camera mis-focus. In cases like motion blur, it is possible to come
up with a very good estimate of the actual blurring function and "undo" the blur to restore the
original image. In cases where the image is corrupted by noise, the best we may hope to do is to
compensate for the degradation it caused. Image restoration differs from image enhancement in
that the latter is concerned more with accentuation or extraction of image features rather than
restoration of degradations. Image restoration problems can be quantified precisely, whereas
enhancement criteria are difficult to represent mathematically. Image restoration started in
1950s. There are several application domain of image restoration like scientific exploration,
legal investigations, film making and archrivals, image and video decoding and consumer
photography.

Department of ECE Page 9 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

In general there are two types of restoration methods are used. One is non-blind restoration in
which we need prior knowledge of h(x,y). In this case three filtering techniques are generally
used : Wiener filtering, Constraint least square filtering and Lucy Richardson algorithm which
are discussed . Other one is Blind Restoration in which we do not need any prior knowledge of
h(x,y) . The image restoration model is shown in figure 2.3.2. It consist of taking a non-blurred
image f(x,y), creating a known blurring function or point spread function h(x,y) and then
filtering the image with this function so as to add blur into it.This image is further corrupted
additive Gaussian noise to get the degraded image g(x, y). This degraded image is passed
through a restoration filter R(x,y) to get the restored image

Figure : 2.3.2.Image restoration process model

we are focussing on non-blind restoration methods. We have restored the degraded image by
using proposed modified Lucy Richardson Algorithm.Since DWT has excellent spatial
localization and multi-resolution characteristics, which are similar to the theoretical models of
the human visual system it is widely used in image processing. In the proposed modified LR
algorithm we have taken the DWT of degraded image and then apply LR algorithm to it. Further
the performance of the proposed algorithm is compared with wiener filter.
2.3.2 Applications of Image Restoration:
Applications in the field of image restoration are:
The first application of digital image restoration in the engineering community was in the
area of astronomical imaging.Extraterrestrial observations of the Earth and the planets were
degraded by motion blur as a result of slow camera shutter speeds relative to rapid spacecraft
motion. The astronomical imaging degradation problem is often characterized by Poisson noise,
Gaussian noise etc.

Department of ECE Page 10 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

In the area of medical imaging, image restoration has played a very important role. Restoration
has been used for mammograms, filtering of Poisson distributed film-grain noise in chest X-rays
and digital angiographic images, and for the removal of additive noise in Magnetic resonance
Imaging.
Another important application of restoration technique is to restore aging and deteriorated films.
The motion picture restoration is often associated with digital techniques are used to eliminate
scratches and dust from old movies and also to colorize black and white films. There has been
significant work in the area of restoration of image sequences and well explained in literature.
The expanding area of application for digital image restoration is that in the field of image and
video coding. As techniques are developed to improve coding efficiency, and reduce the bit rates
of coded images. Much has been accomplished to develop ways of restoring coded images as a
post-processing step to be performed after decompression.
Digital image recovery has also been used to restore blurred X-ray images of aircraft wings to
improve aeronautical federal control procedures. It is for the recovery of the motion induced in
the present frame or composite effects, and is generally used, restoring television images blurred
uniformly.
2.4.Introduction to Noise Signals:
In hardware, commotion is characterized as an undesired electrical flag. While commotion is
viewed as undesirable much of the time, is picture reproduction in radio space science, radar
imaging and tomography.noise really can be helpful and permit you to describe frameworks.
Since white arbitrary clamor has an intrinsically level recurrence range, you can utilize white
irregular commotion to describe the recurrence reaction of frameworks, for example, channels.

You additionally can utilize falsely made clamor to describe frameworks. Misleadingly made
commotion regularly depends on arbitrary number generators made with a calculation whose
yield rehashes simply after an altogether expansive number of tests. Every yield test is around
measurably free. The calculations used to create irregular numbers frequently depend on a seed
esteem that indicates the beginning stage of the calculation. Current irregular number generators
can create successions that rehash simply after 2^(19937)- 1 tests. This archive gives a review of
the various types of commotion and talks about how you can utilize clamor to portray
frameworks.

Department of ECE Page 11 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

2.4.1.NOISE MODELS:

Commotion tells undesirable data in advanced pictures. Commotion produces undesirable


impacts, for example, ancient rarities, doubtful edges, concealed lines, corners, obscured protests
and aggravates foundation scenes.To diminish these undesirable impacts, earlier learning of
clamor models is vital for further handling. Advanced clamor may emerge from different sorts of
sources, for example, Charge Coupled Device (CCD) and Complementary Metal Oxide
Semiconductor (CMOS) sensors. In some sense, focuses spreading capacity (PSF) and balance
exchange work (MTF) have been utilized for convenient, finish and quantitative investigation of
commotion models. Likelihood thickness work (PDF) or Histogram is likewise used to plan and
portray the clamor models. Here we will talk about few clamor models, their sorts and classes in
computerized pictures.

2.4.1.1. Gaussian Noise Model:

It is also called as electronic noise because it arises in amplifiers or detectors. Gaussian


noise caused by natural sources such as thermal vibration of atoms and discrete nature of
radiation of warm objects.
Gaussian noise generally disturbs the gray values in digital images. That is why Gaussian noise
model essentially designed and characteristics by its PDF or normalizes histogram with respect
to This is given as

Where g = gray value, s = standard deviation and = mean. Generally Gaussian noise
mathematical model represents the correct approximation of real world scenarios. In this noise
model, the mean value is zero, variance is 0.1 and 256 gray levels in terms of its PDF, which is
shown in Fig.2.4.1.a(i).

Department of ECE Page 12 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure.2.4.1.a(i).PDF of Gaussian noise

Due to this equal randomness the normalized Gaussian noise curve look like in bell shaped. The
PDF of this noise model shows that 70% to 90% noisy pixel values of degraded image in
Between s and +s. The shape of normalized histogram is almost same in spectral domain.

A likelihood conveyance portraying irregular vacillations in a constant physical process; named


after Karl Friedrich Gauss, an eighteenth century German physicist. The dissemination portrays
such STOCHASTIC PROCESS as the arbitrary voltage varieties in a carbon resistor because of
warm movement, or the alleged Brownian movement found by Robert Brown, the English
botanist who in 1827 initially contemplated the quick and obviously irregular movements of
moment particles in a gas as observed through a magnifying lens. The equation for the
circulation infers that substantial deviations from the mean turn out to be less likely as indicated
by exp(- x2). It is otherwise called a de Moivre or typical dissemination. At the point when an
electrical variety complies with a Gaussian appropriation, for example, on account of warm
movement refered to above, it is called Gaussian clamor, or RANDOM NOISE. Different cases
happen with a few sorts of radio tubes or semi-conductors where the commotion might be
enhanced to create a clamor generator. Take note of that in these cases, it is just the flag's
adequacy fluctuating arbitrarily that outcomes in its being named Gaussian clamor. Its
SPECTRUM is not really like that of WHITE NOISE.

Example: Gaussian noise produced with about 4000 pulses/sec.

Department of ECE Page 13 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure:2.4.1.a(ii).Gaussian distribution showing the probability y of finding a deviation x

Gaussian distribution showing the probability y of finding a deviation x from the mean (x = 0),
according to the equation stated, where e is the base of natural logarithms, and s is the standard
deviation. The probability of larger and larger deviations can be seen to decrease rapidly.

2.4.1.2.Impulse Valued Noise (Salt and Pepper Noise):


This is also called data drop noise because statistically its drop the original data values.
This noise is also referred as salt and pepper noise. However the image is not fully corrupted by
salt and pepper noise instead of some pixel values are changed in the image. Although in noisy
image, there is a possibilities of some neighbours does not changed.
This noise is seen in data transmission. Image pixel values are replaced by corrupted pixel values
either maximum or minimum pixel value i.e., 255 or 0 respectively, if number of bits are 8 for
transmission.
Let us consider 3x3 image matrices which are shown in the Fig. 3. Suppose the central value of
matrices is corrupted by Pepper noise. Therefore, this central value i.e., 212 is given in Fig. 3 is
replaced by value zero. In this connection, we can say that, this noise is inserted dead pixels
either dark or bright. So in a salt and pepper noise, progressively dark pixel values are present in
bright region and vice versa.

Department of ECE Page 14 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure: 2.4.1.b(i). The central pixel value is corrupted by Pepper noise


Inserted dead pixel in the picture is due to errors in analog to digital conversion and errors in bit
transmission. The percentagewise estimation of noisy pixels, directly determine from pixel
metrics. The PDF of this noise is shown in the Fig. 2.4.1.b(ii).

Figure: 2.4.1.b(ii). The PDF of Salt and Pepper noise

The motivation behind this test is to show that unearthly separating strategies may not generally
be fruitful when the clamor in the picture is exceedingly non-Gaussian. We consider salt-and-
pepper clamor, for which a specific measure of the pixels in the picture are either dark or white
(henceforth the name of the commotion). Salt-and-pepper commotion can, e.g., be utilized to
model imperfections in the CCD or in the transmission of the picture. Given the likelihood r
(with 0 r 1) that a pixel is ruined, we can present salt-and-pepper clamor in a picture by
setting a small amount of r=2 haphazardly chose pixels to dark, and another portion of r=2
arbitrarily chose pixels to white. Straightforward de-noising of such pictures by method for low-
pass channels was considered. Consider now the deblurring issue with salt-and-pepper clamor.
We consider the practical circumstance where the obscured picture is defiled after it is recorded
on the CCD. In this model, we first make an obscured picture spoke to by bexact = Ax and after

Department of ECE Page 15 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

that we bring salt-and-pepper commotion into this picture as depicted above, prompting to the
boisterous picture.

For your favorite grayscale test image, add Gaussian blurring to the image using psfGauss with
sigma = 2, and then corrupt 0.2 % of the pixels (i.e., r = 0:002) with salt-and-pepper noise. Then
reconstruct the image using TSVD and/or Tikhonov regularization with threshold tol and
regularization parameter alpha about 0.01. You should observe severe ringing effects in the
deblurred image around the corrupted pixels, similar to those shown in the figure below.

Figure: 2.4.1.b(iii). Exact image figure: 2.4.1.b(iv).Blurred image with salt-and-pepper noise

2.4.1.3.Rayleigh noise:
A Rayleigh distribution is often observed when the overall magnitude of a vector is
related to its directional components. One example where the Rayleigh distribution naturally
arises is when wind velocity is analyzed into its orthogonal 2-dimensional vector components.
Assuming that each component is uncorrelated, normally distributedwith equal variance, and
zero mean, then the overall wind speed (vector magnitude) will be characterized by a Rayleigh
distribution. A second example of the distribution arises in the case of random complex numbers
whose real and imaginary components are independently and identically
distributed Gaussian with equal variance and zero mean. In that case, the absolute value of the
complex number is Rayleigh-distributed.
Rayleigh noise presents in radar range images. In Rayleigh noise, probability density function is
given as

Department of ECE Page 16 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure:2.4.1.c(i).Rayleigh distribution

Figure:2.4.1.c(ii). Rayleigh Noise

Department of ECE Page 17 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

2.5.Blur Models:
Motion blur occurs when there is relative motion between the object and the camera
during exposure. This can be in the form of a translation, a rotation, a sudden change of scale, or
some combinations of these.

Atmospheric turbulence occurs due to random variations in the reflective index of the medium
between the object and the imaging system and it occurs in the imaging of astronomical objects.

When a camera images a 3-D scene onto a 2-D imaging plane, some parts of the scene are in
focus while other parts are not. If the aperture of the camera is circular, the image of any point
source is a small disk, known as the circle of confusion (COC). The degree of defocus (diameter
of the COC) depends on the focal length and the aperture number of the lens, and the distance
between camera and object. An accurate model not only describes the diameter of the COC, but
also the intensity distribution within the COC. However, if the degree of defocusing is large
relative to the wavelengths considered, a geometrical approach can be followed resulting in a
uniform intensity distribution within the COC. Uniform out of focus

Department of ECE Page 18 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

2.6.Filters:

2.6.1.Wiener Filter:

The Wiener channel is the MSE-ideal stationary linearfilter for pictures debased by added
substance commotion and obscuring. The fundamental detriment of Weiner channel is that it
can't deal with clamors. So least mean square blunder sifting (Weiner channel) is utilized which
joins both the debasement work and measurable attributes of clamor into picture reclamation
prepare. In this technique it is expected that the clamor and corruption capacity are uncorrelated.
One of them has zero mean. The target capacity of Weiner channel isas takes after,

The main disadvantage of Weiner filter is that the power spectra of undergraded image and
power spectra of noise.Calculation of the Wiener filter requires the assumption that the signal
and noise processes are second-order stationary (in the random process sense).
Wiener filters are often applied in the frequency domain. Given a degraded image x(n,m), one
takes the Discrete Fourier Transform (DFT) to obtain X(u,v). The original image spectrum is
estimated by taking the product of X(u,v) with the Wiener filter G(u,v):

The inverse DFT is then used to obtain the image estimate from its spectrum. The Wiener filter is
defined in terms of these spectra:
H(u,v) fourier transform of the point-spread function (PSF)
Pr(u,v) power spectrum of the signal process, obtained by talking the fourier transform of
the signal autocorrelation
Pu(u,v) power spectrum of the noise process, obtained by talking the fourier transform of
the noise autocorrelation.

Department of ECE Page 19 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

The Wiener filter is:

Wiener channels can't reconstructfrequency segments which have been corrupted by commotion.
They can just stifle them. Additionally, Wiener channels can't reestablish parts for which
H(u,v)=0. This implies they can't fix obscuring created by bandlimiting of H(u,v). Such
bandlimiting which happens in any certifiable imaging framework.
Wiener channels are similarly ease back to apply, since they require working in the recurrence
area. To accelerate sifting, one can take the converse FFT of the Wiener channel G(u,v) to get a
motivation reaction g(n,m). This motivation reaction can be truncated spatially to deliver a
convolution veil. The spatially truncated Wiener channel is mediocre compared to the recurrence
space rendition, yet might be much speedier.
2.6.2. Median Filter:
In flag preparing, it is regularly attractive to have the capacity to play out some sort of
commotion lessening on a picture or flag. The middle channel is a nonlinear advanced
filteringtechnique, frequently used to evacuate commotion. Such clamor diminishment is an
average pre-preparing venture to enhance the aftereffects of later handling (for instance, edge
identification on a picture). Middle separating is generally utilized as a part of advanced picture
preparing in light of the fact that, under specific conditions, it jelly edges while expelling

Department of ECE Page 20 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

noise.Median sifting is a nonlinear strategy used to expel commotion from pictures. It is broadly
utilized as it is exceptionally viable at expelling commotion while safeguarding edges. It is
especially viable at expelling 'salt and pepper' sort commotion. The middle channel works by
traveling through the picture pixel by pixel, supplanting every esteem with the middle benefit of
neighboring pixels. The example of neighbors is known as the "window", which slides, pixel by
pixel over the whole picture 2 pixel, over the whole picture. The middle is figured by first sorting
all the pixel values from the window into numerical request, and after that supplanting the pixel
being considered with the center (middle) pixel esteem.
Image filtering is used to: Remove noise ,Sharpen contrast ,Highlight contours ,Detect edges .
Image filters can be classified as linear or nonlinear. 1 Linear filters are also know as convolution
filters as they can be represented using a matrix multiplication. Thresholding and image
equalisation are examples of nonlinear operations, as is the median filter.
Figure shows an image, heavily corrupted by salt and pepper noise and 3x3 median filtered is
used to remove the noise.

Figure:2.6.2.a. Noisy Image and Median filtered image

Department of ECE Page 21 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure:2.6.2.b. median filter restoration

Figure :2.6.2.c.Image degradation and restoration techniques


Figure show the same noisy image heavily corrupted by salt and pepper noise and median filter
of window size (9x9) is used. The higher the window size of median filter there is a higher
chance of image degradation.
(Image: Cameraman, Filter: Median)

Table :2.6.2.d. PSNR value (dB) for % of salt and pepper noise
To restore an image from linear degradation inverse filter, pseudo inverse filter, Weiner filter and
blind deconvolution is used. These techniques are discussed below.
2.6.3. Inverse Filtering:
n signal processing for a filter g, an inverse filter h is one such that the sequence of
applying g then h to a signal results in the original signal. Software or electronic inverse filters
are often used to compensate for the effect of unwanted environmental filtering of signals.

Department of ECE Page 22 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Degraded Image Restored Image

Figure :2.6.3.a. Image degradation and restoration using inverse Filter


2.6.4. Pseudo Inverse Filter:
. In the Inverse Filtering lesson, the obscured picture pixels are drifting point. On the off
chance that that picture is changed over to unsigned byte information sort, the outcome is like
subtracting a consistent dissemination of commotion with qualities from 0 to 1. Despite the fact
that these distinctions don't bring about any issue with our visual view of the picture, it assumes
a vital part in picture rebuilding by the backwards separating system

Figure:2.6.4.a.blurred image data type byte, figure:2.6.4.b.difference between the float and byte
type images
Pseudo inverse filter can be expressed as

Department of ECE Page 23 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

CHAPTER 3
UNIVERSAL ALGORITHM
3.1 Introduction:
3.1.1. PSF& Lucy Richardson algorithm:
The point spread capacity (PSF) depicts the reaction of an imaging framework to a point
source or point question. A more broad term for the PSF is a framework's motivation reaction,
the PSF being the drive reaction of a centered optical framework. The PSF in numerous settings
can be considered as the expanded blob in a picture that speaks to an uncertain question. In
useful terms it is the spatial space form of the exchange capacity of the imaging framework. It is
a helpful idea in Fourier optics, galactic imaging, restorative imaging, electron microscopy and
other imaging methods, for example, 3D microscopy (like in confocal laser filtering microscopy)
and fluorescence microscopy. The level of spreading (obscuring) of the point protest is a measure
for the nature of an imaging framework. In non-sound imaging frameworks, for example,
fluorescent magnifying instruments, telescopes or optical magnifying instruments, the picture
arrangement process is direct in power and portrayed by straight framework hypothesis. This
implies when two protests An and B are imaged all the while, the outcome is equivalent to the
entirety of the autonomously imaged objects. At the end of the day: the imaging of An is
unaffected by the imaging of B and the other way around, inferable from the non-communicating
property of photons. The picture of an intricate question can then be viewed as a convolution of
the genuine protest and the PSF. Be that as it may, when the distinguished light is rational,
picture development is direct in the perplexing field. Recording the power picture then can
prompt to cancelations or other non-straight impacts.
The steps involved in Lucy Richardson and PSF are as shown below
Step 1: Read Image
Step 2: Simulate a Blur and Noise

Step 3: Restore the Blurred and Noisy Image

Step 4: Iterate to Explore the Restoration

Step 5: Control Noise Amplification by Damping

Step 6: Create Sample Image

Department of ECE Page 24 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Step 7: Simulate a Blur

Step 8: Provide the WEIGHT Array

Step 9: Provide a finer-sampled PSF

This example shows how to use the Lucy-Richardson algorithm to deblur images. It can be used
effectively when the point-spread function PSF (blurring operator) is known, but little or no
information is available for the noise. The blurred and noisy image is restored by the iterative,
accelerated, damped Lucy-Richardson algorithm. The additional optical system (e.g. camera)
characteristics can be used as input parameters to improve the quality of the image restoration.

Read Image:

The example reads in an RGB image and crops it to be 256-by-256-by-3.


The deconvlucy function can handle arrays of any dimension

Figure.3.1 original image

Simulate a Blur and Noise:

Simulate a real-life image that could be blurred (e.g., due to camera motion or lack of
focus) and noisy (e.g., due to random disturbances). The example simulates the blur by
convolving a Gaussian filter with the true image (using imfilter). The Gaussian filter then
represents a point-spread function, PSF.

Department of ECE Page 25 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure.3.1.2 blurred

The example simulates the noise by adding a Gaussian noise of variance V to the blurred image
(using imnoise). The noise variance V is used later to define a damping parameter of the
algorithm

Figure.3.1.3.blurred and noise

Restore the Blurred and Noisy Image:

Restore the blurred and noisy image providing the PSF and using only 5 iterations
(default is 10). The output is an array of the same type as the input image

Department of ECE Page 26 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure.3.1.4 Restored image, NUMIT=5

Iterate to Explore the Restoration:

The subsequent picture changes with every cycle. To research the advancement of the
picture reclamation, you can do the deconvolution in steps: do an arrangement of emphasess, see
the outcome, and afterward continue the cycles from where they were halted. To do as such, the
information picture must be passed as a part of a cell cluster (e.g., begin first arrangement of
emphasess by going in {BlurredNoisy}instead of BlurredNoisy as information picture
parameter). All things considered the yield, luc1_cell, turns into a cell exhibit. The cell yield
comprises of four numeric clusters, where the first is theBlurredNoisy picture, the second is the
reestablished picture of class twofold, the third exhibit is the consequence of the one-preceding
last emphasis, and the fourth cluster is an inward parameter of the iterated set. The second
numeric exhibit of the yield cell-cluster, picture luc1_cell{2}, is indistinguishable to the yield
exhibit of the Step 3, picture luc1, with a conceivable special case of their class (the cell yield
dependably gives the reestablished picture of class twofold).

To continue the cycles, take the yield from the past capacity call, the phone cluster
luc1_cell, and pass it into thedeconvlucy work. Utilize the default number of emphasess
(NUMIT = 10). The reestablished picture is the consequence of a sum of 15 emphasess.

Department of ECE Page 27 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure.3.1.5 Restored Image, NUMIT=15

Control Noise Amplification by Damping :

The most recent picture, luc2, is the consequence of 15 cycles. Despite the fact that it is
more honed than the before result from 5 cycles, the picture builds up a "dotted" appearance. The
dots don't relate to any genuine structures (contrast it with the genuine picture), yet rather are the
aftereffect of fitting the commotion in the information too nearly.To control the commotion
intensification, utilize the damping choice by indicating the DAMPAR parameter. DAMPAR
must be of an indistinguishable class from the info picture. The calculation hoses changes in the
model in areas where the distinctions are little contrasted and the clamor. The DAMPAR utilized
here equivalents 3 standard deviations of the commotion. See that the picture is smoother.

Figure.3.1.6 Restored Image with Damping, NUMIT=15

Department of ECE Page 28 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Create Sample Image :

The example creates a black/white image of four stars

Figure.3.1.7 Data

Simulate a Blur :

The case reproduces an obscure of the picture of the stars by making a Gaussian channel,
PSF, and convolving it with the genuine picture. Presently recreate a camera that can just watch
part of the stars' pictures (just the obscure is seen). Make a weighting capacity exhibit, WEIGHT,
that comprises of ones in the focal part of the Blurred picture ("great" pixels, situated inside the
dashed lines) and zeros at the edges ("terrible" pixels - those that don't get the flag)

Figure.3.1.8 Observed

Department of ECE Page 29 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Provide the WEIGHT Array :

The calculation weights every pixel esteem as indicated by the WEIGHT exhibit while
reestablishing the picture. In our illustration, just the estimations of the focal pixels are utilized
(where WEIGHT = 1), while the "terrible" pixel qualities are avoided from the improvement. Be
that as it may, the calculation can put the flag control into the area of these "awful" pixels, past
the edge of the camera's view. See the precision of the determined star positions

Figure.3.1.9 Restored

Provide a finer-sampled PSF :

deconvlucy can reestablish undersampled picture given a better examined PSF (better by
SUBSMPL times). To recreate the inadequately determined picture and PSF, the case canisters
the Blurred picture and the first PSF, two pixels in one, in every measurement. Reestablish the
undersampled picture, BinnedImage, utilizing the undersampled PSF, BinnedPSF. See that the
luc5 picture recognizes just 3 stars The following case reestablishes the undersampled picture
(BinnedImage), this time utilizing the better PSF (characterized on a SUBSMPL-times better
framework). The reproduced picture (luc6) determines the position of the stars all the more
precisely. Take note of how it circulates control between the two stars in the lower right corner of
the picture. This insights at the presence of two brilliant articles, rather than one, as in the past
rebuilding.

Department of ECE Page 30 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure.3.1.10 Binned Observered

Figure 3.1.11Fine PSF

Figure.3.1.12: Poor PSF


3.2. Point Spread Function:
The Point Spread Function describes the response of an imaging system to a point source
or point object. Following is an example of a PSF:

Department of ECE Page 31 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure: 3.2.Example of PSF


The Blind Deconvolution Algorithm can be utilized successfully when no data about the bending
(obscuring and clamor) is known. The calculation reestablishes the picture and the point-spread
capacity (PSF) all the while. The quickened, damped Richardson-Lucy calculation is utilized as a
part of every cycle. Extra optical framework (e.g. camera) attributes can be utilized as info
parameters that could enhance the nature of the picture rebuilding. Daze deconvolution is the
issue of recuperating a sharp form of an information hazy picture when the obscure part is
obscure. Scientifically

Where x is a visually plausible sharp image, and k is a non negative blur kernel, whose support
is small compared to the image size.
3.3. Process of Image Restoration:
Image restoration is an emerging field of image processing in which the focus is on
recovering an original image from a degraded image. The degraded image can be a result of a
known degradation or unknown degradation. Hence image restoration can be defined as a
process of recovering a sharp image from a degraded image which is blurred by a degradation
function, commonly by a Point Spread Function (PSF).
The process of image restoration includes two sub processes. The first part deals with
degrading the quality of the image by adding blur and noise to an image and the second part
deals with removing noise and blur from the degraded image and recovering the original image.

Department of ECE Page 32 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

These two sub processes are named as degradation model and restoration model respectively.
Both these are discussed below.
3.3.1 Degradation model:
In degradation model, the image is blurred using degradation function and additive noise.
The following Figure 1 represents the structure of degradation model

Figure: 3.3.1. Degradation Model


The degraded image can be described by the following equation:
g = h * f + n (1)
In equation (1), g is the degraded image, h is the degradation function, f is an original image and
n is the additive noise.
3.3.2.Restoration model:
In Restoration model, the degraded image is reconstructed using restoration filters. In this
process noise and blur factor is removed and we get an estimate of the original image as a result
of restoration.The closer the estimated image is to the original image the
more efficient is our restoration filter. Figure 2 represents the structure of restoration model

Figure.3.3.2.Restoration Model

Department of ECE Page 33 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

3.4. Image Restoration techniques:


There are numerous techniques and algorithms available for Image restoration. Each
technique has its own features.Broadly, Image restoration techniques are classified into two
categories which are shown in Figure 3.4. below:

Figure: 3.4. Image Restoration Techniques


Following is a brief introduction of both the image restoration techniques .
Blind Image Restoration: This Technique allows the reconstruction of original images from
degraded images even when we have very little or no knowledge about PSF.
Blind Image Deconvolution (BID) is an algorithm of this type. These techniques are more
difficult to implement and are more complicated as compared to other category.
Non-Blind Restoration: This Technique helps in the reconstruction of original images from
degraded images when we know that how image was degraded i.e. we have a knowledge about
PSF. LRA i.e. Deconvolution using Lucy Richardson Algorithm is one among various nonblind
techniques.

Department of ECE Page 34 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

CHAPTER 4
DESIGN APPROACH

4.1 Richardson-Lucy Deconvolution Algorithm:


The RichardsonLucy algorithm, also known as LucyRichardson deconvolution, is
an iterative procedure for recovering a latent image that has been blurred by a known point
spread function. It was named after William Richardson and Leon Lucy.
The RichardsonLucy deconvolution algorithm has become popular in the fields of astronomy
and medical imaging. Initially it was derived from Bayess theorem in the early 1970s by
Richardson and Lucy. Pixels in the observed image can be represented by

4.2.Lucy Richardson Algorithm:


The restoration methods which are discussed above are linear. They are also direct in the
sense that, once therestoration filter is specified, the solution is obtained in one go. During the
past two decades, non-liner iterative methods have been gaining there acceptance as restoration
tool that often yield result better than those obtained with linear methods.The Lucy Richardson
(LR) algorithm is an iterative nonlinear restoration method.The L-R algorithm arises from
maximum likelihood formulation in which image is modelled with poison statistics. Maximizing
the likelihood function of the model yield an equation that is satisfied when following iteration
converges:
While using this method, there arises an obvious question of where to stop. It is difficult to claim
any specific value for the number of iterations; a good solution depends on the size and
complexity of the PSF matrix. The algorithm usually reaches astable solution very quickly (few
steps) with a small PSF matrix.But if one stops after a very few iterations then the image maybe
very smooth. On the other hand, increasing the number of iterations not only slows down the

Department of ECE Page 35 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

computational process, but also amplifies noise and introduces the ringing effect. Some
additional methods for ringing reduction are given in it. Thus for the good quality of restored
image, the optimal number of iterations are determined manually fore very image as per the PSF
size.
LRA stands for Lucy Richardson Algorithm which is used for image restoration. It is a non blind
technique of image restoration, used to restore a degraded image that has been degraded by a
known PSF. It is an iterative procedure in which the pixels of the observed image.
The Lucy-Richardson Algorithm is an outstanding iterative technique for the deconvolution of
pictures convolved with a known point spread capacity. It is gotten from a factual perspective as
it focalizes to the most extreme probability arrangement under the condition that the information
take after a Poisson dissemination. This supposition remains constant for pictures distinguished
by a computerized camera. In any case, there are pictures not taking after a Poisson yet rather a
non focal chi-square dispersion. Here an adaption of the Lucy-Richardson calculation to be
utilized for information taking after this likelihood appropriation is appeared. Its application to
mimicked and genuine information from an imaging radar sensor demonstrates its different
preferences of the first calculation. Lucy Richardson is an outstanding calculation utilized for
reestablishing the debased pictures. It is utilized when learning about the sources which have
really corrupted the first picture is known. It gives us a gauge of the first picture.

4.3. Proposed Modified Lucy Richardson Algorithm:


In the proposed technique we have taken the DWT of corrupted picture, so
we will talk about the properties of DWT in short. DWT has phenomenal
spatial confinement and multiresolution qualities, which are like the
hypothetical models of the human visual system.The unique picture is
decayed into four sub-band pictures by DWT:
three high recurrence parts (HL, LH and HH, named detail sub pictures) and
one low recurrence part (LL, named surmised sub-picture). The detail sub-
pictures contain the periphery data while the estimated sub-picture is the
meeting of quality of unique picture. In respect to the detail sub-pictures,
surmised sub picture is a great deal more steady, since the greater part of
picture vitality focuses here. Along these lines, we will apply
Lucy Richardson calculation to LL sub-band picture.

Department of ECE Page 36 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

1) Take a non-obscured picture fof estimate 512x512.


2) Add Gaussian or Motion Blur to it to deliver obscured picture bf.
3) Now add Gaussian clamor to bfto create debased picture G.
4) DWT is connected to corrupted picture Gto deteriorate it into four sub-
groups LL,
HL , LH and HH each of size 256x256.
5) Choose LL sub-band and after that apply LR technique to it to deliver the
reestablished
low recurrence band LLM
6) Apply thresholding to residual sub pictures i.e. HL, LH, HH.
7) Apply opposite DWT to LLM, HL, LH and HH to get the reestablished
picture.
4.4. MEDICAL IMAGE RESTORATION:
Picture rebuilding methods are utilized as a part of a different regions. Their applications
are extremely inconceivable extending from straightforward pictures to complex restorative
pictures. They can be connected to reestablish pictures from galactic field like radar pictures,
pictures from restorative field, satellite pictures that show vegetation or those satellite pictures
that concentrate on woods ranges and some more. In this paper, medicinal picture rebuilding is
engaged on the grounds that they are of most extreme significance nowadays and their
reclamation is exceptionally muddled.
4.4.1. Medical Images:
Medical Images are used to detect a number of diseases which cannot be detected
otherwise. But these medical images may be contaminated with noise or blur which makes the
detection of the disease difficult for doctors. So restoration of such contaminated medical images
is must for the well being of the common people.There are a number of medical images some of
which are X-ray Images, Ultrasound Images, MRI, endoscopic images, CT scan Images,
Mammographic images which are useful in the detection of one ailment or the other.

Department of ECE Page 37 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure: 4.4.1.Medical Images


4.4.2. X-ray Images:
X-ray imaging is a prevalent and most regularly utilized strategy for diagnosing the inside bone
structures of the body. It is utilized to discover orthopedic harm, tumors, pneumonias, outside
items, and so forth.
An X-ray shaft is gone through the body where a bit of the X-rays are either retained or scattered
by the inside structures, and the rest of the X-ray example is transmitted to an indicator (e.g.,
film or a PC screen) for recording or further handling by a PC. These exams vary in their
motivation. Some of the time these pictures get debased as a result of a few reasons which can be
reestablished with help of different calculations.
4.4.3. X-ray Image Restoration:
X-ray pictures are exceptionally advantageous now days for the location of various
illnesses. Lamentably, X-ray pictures seem low picture quality brought on by genuinely low
spatial determination and the nearness of clamor. X-ray pictures likewise experience the ill
effects of commotion and obscure so they additionally require reclamation with a specific end
goal to evacuate obscure and clamor. Consequently rebuilding of X-ray pictures is extremely
testing. Both the reclamation methods examined in Section-II can be connected for the rebuilding
of X-ray pictures. X-ray pictures essentially experience the ill effects of movement obscure and
some sort of clamor like Gaussian commotion. Offered calculation can effectively reestablish the
debased X-ray pictures yet LRA have a few issues while evacuating the impacts of clamor and
also obscure from the X-ray pictures.

Department of ECE Page 38 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

CHAPTER - 5
SOFTWARE DESCRRITION
5.1 Introduction:
5.1.1 What is matlab:
The name MATLAB stands for MATrix LABoratory. MATLAB was written originally to
provide easy access to matrix software developed by the LINPACK (linear system package)and
EISPACK (Eigen system package) projects.
MATLAB is a high-performance language for technical computing. It integrates
computation, visualization, and programming environment. Furthermore, MATLAB is a
modern programming language environment: it has sophisticated data structures, contains built-
in editing and debugging tools, and supports object-oriented programming. These factors make
MATLAB an excellent tool for teaching and research.
MATLAB has many advantages compared to conventional computer languages (e.g., C,
FORTRAN) for solving technical problems. MATLAB is an interactive system whose basic data
element is an array that does not require dimensioning. The software package has been
commercially available since 1984 and is now considered as a standard tool at most universities
and industries worldwide.
5.1.2 A minimum MATLAB session
The goal of this minimum session (also called starting and exiting sessions) is to learn
therst steps:
How to log on

Department of ECE Page 39 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Invoke MATLAB
Do a few simple calculations
How to quit MATLAB
5.1.3 Starting MATLAB
After logging into your account, you can enter MATLAB by double-clicking on the
MATLAB shortcut icon (MATLAB 7.0.4) on your Windows desktop. When you start MATLAB,
a special window called the MATLAB desktop appears. The desktop is a window that contains
other windows. The major tools within or accessible from the desktop are:
The Command Window
The Command History
The Workspace
The Current Directory
The Help Browser
The Start button

Figure 5.1: The graphical interface to the MATLAB workspace


When MATLAB is started for the rst time, the screen looks like the one that shown in
the Figure 5.1. This illustration also shows the default conguration of the MATLAB desktop.
You can customize the arrangement of tools and documents to suit your needs. Now, we are

Department of ECE Page 40 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

interested in doing some simple calculations. We will assume that you have sucient
understanding of your computer under which MATLAB is being run.
You are now faced with the MATLAB desktop on your computer, which contains the prompt
(>>) in the Command Window. Usually, there are 2 types of prompt:
>> for full version
EDU> for educational version
Note: To simplify the notation, we will use this prompt, >>, as a standard prompt sign, though
our MATLAB version is for educational purpose.
5.1.4 Quitting MATLAB
To end your MATLAB session, type quit in the Command Window, or select File ! Exit
MATLAB in the desktop main menu.

5.2 Creating MATLAB variables


MATLAB variables are created with an assignment statement. The syntax of variable as-
signment is
variable name = a value (or an expression)
For example,
>> x = expression
where expression is a combination of numerical values, mathematical operators, variables, and
function calls. On other words, expression can involve:
manual entry
built-in functions
user-defined functions
5.2.1 Overwriting variable
Once a variable has been created, it can be reassigned. In addition, if you do not wish to see the
intermediate results, you can suppress the numerical output by putting a semicolon (;) at the end
of the line. Then the sequence of commands looks like this:
>> t = 5;
>> t = t+1
t=
6

Department of ECE Page 41 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

5.2.2 Error messages


If we enter an expression incorrectly, MATLAB will return an error message. For example, in the
following, we left out the multiplication sign, *, in the following expression
>> x = 10;
>> 5x
??? 5x
|
Error: Unexpected MATLAB expression.

5.2.3Managing the workspace

The contents of the workspace persist between the executions of separate commands.
There-fore, it is possible for the results of one problem to have an eect on the next one. To
avoid this possibility, it is a good idea to issue a clear command at the start of each new
independent calculation.The command clear or clear all removes all variables from the
workspace. This frees up system memory. In order to display a list of the variables currently in
the memory,type>> who while, whos will give more details which include size, space allocation,
and class of the variables.

5.2.4Miscellaneous commands

Here are few additional useful commands:


To clear the Command Window, type clc
To abort a MATLAB computation, type ctrl-c
To continue a line, type . . .
5.2.5 Getting help
To see the online documentation, select MATLAB Help from Help menu or MATLAB Help
straightforwardly in the Command Window. The favored technique is to utilize the Help
Browser. The Help Browser can be begun by selecting the ? symbol from the desktop toolbar.
Then again, data about any order is accessible by writing
>> Command
Another approach to get encourage is to utilize the lookfor summon. The lookfor charge diers
from the summon. The charge hunt down a correct capacity name coordinate, while the lookfor

Department of ECE Page 42 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

summon seeks the fast rundown data in every capacity for a match. For instance, assume that we
were searching for a capacity to take the opposite of a network. Since MATLAB does not have a
capacity named converse, the order help reverse will deliver nothing. Then again, the order
lookfor converse will create nitty gritty data, which incorporates the capacity of intrigue, inv.
>> lookfor inverse
Note - At this specific time of our study, it is vital to underscore one principle point.
Since MATLAB is a tremendous program; it is difficult to cover every one of the points of
interest of every capacity one by one. Notwithstanding, we will give you data how to get offer
assistance. Here are a few cases:
Use on-line ask for data on a specic work

>> help sqrt


In the present variant (MATLAB adaptation 7), the doc work opens the on-line form of the help
manual. This is exceptionally useful for more mind boggling charges
>> doc plot
10
Use lookfor to nd functions by keywords. The general form is
>> lookfor FunctionName

5.3 Introduction to programming in MATLAB

5.3.1 Introduction
So far in these lab sessions, all the commands were executed in the Command Window.
The problem is that the commands entered in the Command Window cannot be saved and
executed again for several times. Therefore, a dierent way of executing repeatedly commands
with MATLAB is:
1. to create a le with a list of commands,
2. save the le, and
3. run the le.

Department of ECE Page 43 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

If needed, corrections or changes can be made to the commands in the le. The les that are used
for this purpose are called script les or scripts for short. This section covers the following
topics:
M-File Scripts
M-File Functions
5.3.2 M-File Scripts
A script file is an external le that contains a sequence of MATLAB statements. Script files have
a filename extension .m and are often called M-files. M-files can be scripts that simply execute a
series of MATLAB statements, or they can be functions that can accept arguments and can
produce one or more outputs.
35
5.3.2.1 Examples
Here are two simple scripts.
Example 1
Consider the system of equations:
x + 2y + 3z = 1
3x + 3y + 4z = 1
2x + 3y + 3z = 2
Find the solution x to the system of equations.
Solution: Use the MATLAB editor to create a le: File ! New ! M-le.
Enter the following statements in the le:
A = [1 2 3; 3 3 4; 2 3 3];
b = [1; 1; 2];
x = A\b
Save the file, for example, example1.m.
Run the file, in the command line, by typing:
>> example1
x=
-0.5000
1.5000
-0.5000

Department of ECE Page 44 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

When execution completes, the variables (A, b, and x) remain in the workspace. To see a listing
of them, enter whos at the command prompt.
Note: The MATLAB editor is both a text editor specialized for creating M-les and a graphical
MATLAB debugger. The MATLAB editor has numerous menus for tasks such as saving,
viewing, and debugging. Because it performs some simple checks and also uses color to
dierentiate between various elements of codes, this text editor is recommended as the tool of
choice for writing and editing M-les.
There is another way to open the editor:
36
>> edit
or
>> edit filename.m
to open filename.m.

5.3.3 M-File functions


As mentioned earlier, functions are programs (or routines) that accept input arguments
and return output arguments. Each M-le function (or function or M-le for short) has its own
area of workspace, separated from the MATLAB base workspace.
5.3.3.1 Anatomy of a M-File function
This simple function shows the basic parts of an M-le.
function f = factorial(n) (1)
% FACTORIAL(N) returns the factorial of N. (2)
% Compute a factorial value. (3)
f = prod(1:n); (4)
The rst line of a function M-le starts with the keyword function. It gives the function name and
order of arguments. In the case of function factorial, there are up to one output argument and one
input argument. Table 4.1 summarizes the M-le function.
As an example, for n = 5, the result is,
>> f = factorial(5)
f=

Department of ECE Page 45 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

120
Table 5.3.3.(i): Anatomy of a M-File function
Part no. M-file element Description
(1) Function Dene the function name, and the
denition number and order of input and
line output arguments
(2) H1 line A one line summary description
of the program, displayed when you
request Help
(3) Help text A more detailed description of
the program
(4) Function body Program code that performs
the actual computations

Both functions and scripts can have all of these parts, except for the function denition
line which applies to function only.
In addition, it is important to note that function name must begin with a letter, and must
be no longer than than the maximum of 63 characters. Furthermore, the name of the text le that
you save will consist of the function name with the extension .m. Thus, the above example file
would be factorial.m.
Table 5.3.3.(ii): Dierence between scripts and functions
Scripts Functions
- Do not accept input - Can accept input arguments and
arguments or return output return output arguments.
arguments.
- Store variables in a - Store variables in a workspace workspace that is shared internal
to the function. with other scripts
- Are useful for automating - Are useful for extending the MATLAB
a series of commands language for your application

5.3.4 Input and output arguments

Department of ECE Page 46 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

As mentioned above, the input arguments are listed inside parentheses following the
function name. The output arguments are listed inside the brackets on the left side. They are used
to transfer the output from the function le. The general form looks like this function [outputs] =
function_name(inputs) Function le can have none, one, or several output arguments. Table 4.3
illustrates some possible combinations of input and output arguments.
Table 4.3: Example of input and output arguments
function C=FtoC(F) One input argument and one output argument
function area=TrapArea(a,b,h) Three inputs and one output
function [h,d]=motion(v,angle) Two inputs and two outputs
5.3.5. Output commands
As discussed before, MATLAB automatically generates a display when commands are
exe- cuted. In addition to this automatic display, MATLAB has several commands that can be
used to generate displays or outputs. Two commands that are frequently used to generate output
are: disp and fprintf.

CHAPTER 6
SIMULATION RESULTS

1.Image deblurring x ray outputs:

Figure(a):out put image

Department of ECE Page 47 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(b):true PSF

Figure(c):blurred image

Department of ECE Page 48 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(d):Preliminary restoration

Figure(e):Preliminary restoration

Department of ECE Page 49 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(f):original image

Figure(g):blurred and noisy

Department of ECE Page 50 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(h):restored image ,NUMIT=5

2.RICHARDSON CODE:

Department of ECE Page 51 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(i):original image

Figure(ii):blurred

Figure(iii):blurred and noisy

Department of ECE Page 52 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(iv): restored image ,NUMIT=5

Figure(iv): restored image ,NUMIT=15

Department of ECE Page 53 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(iv): restored image with damping,NUMIT=15

3.PSF outputs:

Figure(a):data

Department of ECE Page 54 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(b):observed

Figure(c):binned observed

Department of ECE Page 55 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(d):poor PSF

Figure(e):fine PSF

Department of ECE Page 56 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

Figure(f):restored

CHAPTER 7

CONCLUSION AND FUTURE SCOPE

The results show how to use the Lucy-Richardson algorithm to deblur images. It can be
used effectively when the point-spread function PSF (blurring operator) is known, but little or no
information is available for the noise. The blurred and noisy image is restored by the iterative,
accelerated, damped Lucy-Richardson algorithm.

Department of ECE Page 57 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

References

[1] Amandeep Kaur, Vinay Chopra, A comparative study and analysis of image restoration
techniques using different image formats, International Journal of Science and Emerging
Technologies with latest trends, 2, 1, pp. 7-14, 2012.

[2] M.R. Banham and A.K. Katsaggelos,''Digital Image Restoration,''IEEE Signal Processing
Magazine, Vol. 14, No.2, pp.24-41, March 1997.

[3] M. Ben-Ezra and S.K. Nayar, Motion-based motion deblurring,IEEE Transactions on


Pattern Analysis and Machine Intelligence, Vol. 26, No. 6, pp. 689-698, June 2004.

[4] X. Jiang, D. C. Cheng, et. Al. Motion Deblurring, University of Muenster, Department of
Mathematics and Computer Science, 2005.

[5] R. C. Gonzalez and R. E. Woods, Digital Image Processing Second Edition,Prentice-Hall


India, 2007. [3] A. Name, "Dissertation Title", M.S.(or Ph.D.) thesis, Department, University,
City, Country, Year.

Department of ECE Page 58 SJCET


Image restoration using Lucy Richardson algorithm for X-ray images

[6] G. Li, Y. Ito, et. Al., A discrete wavelet transform based recoverable image processing for
privacy protection, IEEE International Conference on Image Processing, pp. 1372-1375,
October 2008.

[7] M. S. Hsieh, Perceptual Copyright Protection using multiresolution Wavelet Based


Watermarking and Fuzzy Logic,International Journal of Artificial Intelligence & Applications,
Vol.1, No.3, July 2010.

[8] J. M. Parmar and S. A. Patil,Performance Evaluation and Comparison of Modified


Denoising Method and the Local Adaptive Wavelet Image Denoising Method, International
Conference on Intelligent Systems and Signal Processing, pp. 101-105, March 2013.

[9] M. Bertero and P. Boccacci, A simple method for the reduction of boundary effects in the
Richardson-Lucy approach to image deconvolution,Astronomy and Astrophysics,Vol. 437,pp.
369-374, July 2005.

[10] D A Fish, A M Brinicombe, E R Pike, Blind deconvolution by means of the Richardson-


Lucy algorithm, J. Opt. Soc. Am. A., vol. 12, no. 1,Jan 1995, pp 58 65
[11] H C Andrew, B R Hunt, Digital image restoration, Prentice Hall

Department of ECE Page 59 SJCET

You might also like