73
Image Processing 06EC756 SJBIT/ECE Page 1 Unit-1 1. What is digital image processing? Explain the fundamental steps in digital image processing. ( 10 Marks), Jan 2010, july 11, dec 2011 An image may be defined as a two-dimensional function, f(x, y), where x and y are spatial (plane) coordinates, and the amplitude of f at any pair of coordinates (x, y) is called the intensity or gray level of the image at that point. When x, y, and the amplitude values of f are all finite, discrete quantities, we call the image a digital image. The field of digital image processing refers to processing digital images by means of a digital computer. Note that a digital image is composed of a finite number of elements, each of which has a particular location and value. These elements are referred to as picture elements, image elements, pels, and pixels. Pixel is the term most widely used to denote the elements of a digital image. Image acquisition is the first process acquisition could be as simple as being given an image that is already in digital form. Generally, the image acquisition stage involves preprocessing, such as scaling. Image enhancement is among the simplest and most appealing areas of digital image processing. Basically, the idea behind enhancement techniques is to bring out detail that is obscured, or simply to highlight certain features of interest in an image. A familiar example of enhancement is when we increase the contrast of an image because ―it looks better.‖ It is important to keep in mind that enhancement is a very subjective area of image processing.

Ece Vii Image Processing [06ec756] Solution

Embed Size (px)

DESCRIPTION

Image P.

Citation preview

Page 1: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 1

Unit-1

1. What is digital image processing? Explain the fundamental steps in digital image

processing. ( 10 Marks), Jan 2010, july 11, dec 2011

An image may be defined as a two-dimensional function, f(x, y), where x and y are spatial

(plane) coordinates, and the amplitude of f at any pair of coordinates (x, y) is called the

intensity or gray level of the image at that point. When x, y, and the amplitude values of f are

all finite, discrete quantities, we call the image a digital image. The field of digital image

processing refers to processing digital images by means of a digital computer. Note that a

digital image is composed of a finite number of elements, each of which has a particular

location and value. These elements are referred to as picture elements, image elements, pels,

and pixels. Pixel is the term most widely used to denote the elements of a digital image.

Image acquisition is the first process acquisition could be as simple as being given an image

that is already in digital form. Generally, the image acquisition stage involves preprocessing,

such as scaling.

Image enhancement is among the simplest and most appealing areas of digital image

processing. Basically, the idea behind enhancement techniques is to bring out detail that is

obscured, or simply to highlight certain features of interest in an image. A familiar example

of enhancement is when we increase the contrast of an image because ―it looks better.‖ It is

important to keep in mind that enhancement is a very subjective area of image processing.

Page 2: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 2

Image restoration is an area that also deals with improving the appearance of an

image. However, unlike enhancement, which is subjective, image restoration is objective, in

the sense that restoration techniques tend to be based on mathematical or probabilistic

models of image degradation. Enhancement, on the other hand, is based on human subjective

preferences regarding what constitutes a ―good‖ enhancement result.

Color image processing is an area that has been gaining in importance because of

the significant increase in the use of digital images over the Internet. fundamental concepts

in color models and basic color processing in a digital domain. Color is used also in later

chapters as the basis for extracting features of interest in an image.

Wavelets are the foundation for representing images in various degrees of

resolution. In particular, this material is used in this book for image data compression and for

pyramidal representation, in which images are subdivided successively into smaller regions.

Compression, as the name implies, deals with techniques for reducing the storage

required to save an image, or the bandwidth required to transmit it. Although storage

technology has improved significantly over the past decade, the same cannot be said for

transmission capacity. This is true particularly in uses of the Internet, which are

characterized by significant pictorial content. Image compression is familiar (perhaps

inadvertently) to most users of computers in the form of image file extensions, such as the

jpg file extension used in the JPEG (Joint Photographic Experts Group) image compression

standard.

Morphological processing deals with tools for extracting image components that are

useful in the representation and description of shape. The material in this chapter begins a

transition from processes that output images to processes that output image attributes,

Segmentation procedures partition an image into its constituent parts or objects. In general,

autonomous segmentation is one of the most difficult tasks in digital image processing. A

rugged segmentation procedure brings the process a long way toward successful solution of

imaging problems that require objects to be identified individually. On the other hand, weak

or erratic segmentation algorithms almost always guarantee eventual failure. In general, the

more accurate the segmentation, the more likely recognition is to succeed.

Representation and description almost always follow the output of a segmentation

stage, `which usually is raw pixel data, constituting either the boundary of a region (i.e., the

set of pixels separating one image region from another) or all the points in the region itself.

In either case, converting the data to a form suitable for computer processing is necessary.

Page 3: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 3

The first decision that must be made is whether the data should be represented as a boundary

or as a complete region. Boundary representation is appropriate when the focus is on

external shape characteristics, such as corners and inflections. Regional representation is

appropriate when the focus is on internal properties, such as texture or skeletal shape. In

some applications, these representations complement each other. Choosing a

representation is only part of the solution for transforming raw data into a form suitable for

subsequent computer processing. A method must also be specified for describing the data so

that features of interest are highlighted. Description, also called feature selection, deals with

extracting attributes that result in some quantitative information of interest or are basic for

differentiating one class of objects from another.

Recognition is the process that assigns a label (e.g., ―vehicle‖) to an object based on

its descriptors. So far we have said nothing about the need for prior knowledge or about the

interaction between the knowledge base and Knowledge about a problem domain is coded

into an image processing system in the form of a knowledge database.

2. With a neat block diagram, describe various components used in general

purpose image processing system. (10 marks) , June 2012

The function of each component is discussed in the following paragraphs, starting with

image sensing. With reference to sensing, two elements are required to acquire digital

images. The first is a physical device that is sensitive to the energy radiated by the object we

wish to image. The second, called a digitizer, is a device for converting the output of the

physical sensing device into digital form. For instance, in a digital video camera, the sensors

produce an electrical output proportional to light intensity. The digitizer converts these

outputs to digital data.

Specialized image processing hardware usually consists of the digitizer just mentioned, plus

hardware that performs other primitive operations, such as an arithmetic logic unit (ALU),

which performs arithmetic and logical operations in parallel on entire images. One example

of how an ALU is used is in averaging images as quickly as they are digitized, for the

purpose of noise reduction. This type of hardware sometimes is called a front-end subsystem,

and its most

1.5

Page 4: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 4

distinguishing characteristic is speed. In other words, this unit performs functions that

require fast data throughputs (e.g., digitizing and averaging video images at 30 frames_s)

that the typical main computer cannot handle.

The computer in an image processing system is a general-purpose computer and can

range from a PC to a supercomputer. In dedicated applications, sometimes specially

designed computers are used to achieve a required level of performance, but our interest here

is on general-purpose image processing systems. In these systems, almost any well-equipped

PC-type machine is suitable for offline image processing tasks.

Software for image processing consists of specialized modules that perform specific

tasks. A well-designed package also includes the capability for the user to write code that, as

a minimum, utilizes the specialized modules. More sophisticated software packages allow

the integration of those modules and general- purpose software commands from at least one

computer language.

Mass storage capability is a must in image processing applications.An image of size

1024*1024 pixels, in which the intensity of each pixel is an 8-bit quantity, requires one

megabyte of storage space if the image is not compressed. When dealing with thousands, or

even millions, of images, providing adequate storage in an image processing system can be a

challenge. Digital storage for image processing applications falls into three principal

categories: (1) short term storage for use during processing, (2) on-line storage for relatively

fast recall, and (3) archival storage, characterized by infrequent access. Storage is measured

Page 5: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 5

in bytes (eight bits), Kbytes (one thousand bytes), Mbytes (one million bytes), Gbytes

(meaning giga, or one billion, bytes), and T bytes (meaning tera, or one trillion, bytes).

One method of providing short-term storage is computer memory.Another is by specialized

boards, called frame buffers, that store one or more images and can be accessed rapidly,

usually at video rates (e.g., at 30 complete images per second).The latter method allows

virtually instantaneous image zoom, as well as scroll (vertical shifts) and pan (horizontal

shifts). Frame buffers usually are housed in the specialized image processing hardware unit.

Online storage generally takes the form of magnetic disks or optical-media storage. The key

factor characterizing on-line storage is frequent access to the stored data. Finally, archival

storage is characterized by massive storage requirements but infrequent need for access.

Magnetic tapes and optical disks housed in ―jukeboxes‖ are the usual media for archival

applications.

Image displays in use today are mainly color (preferably flat screen) TV monitors.

Monitors are driven by the outputs of image and graphics display cards that are an integral

part of the computer system. Seldom are there requirements for image display applications

that cannot be met by display cards available commercially as part of the computer system.

In some cases, it is necessary to have stereo displays, and these are implemented in the form

of headgear containing two small displays embedded in goggles worn by the user.

Hardcopy devices for recording images include laser printers, film cameras, heat-

sensitive devices, inkjet units, and digital units, such as optical and CD-ROM disks. Film

provides the highest possible resolution, but paper is the obvious medium of choice for

written material. For presentations, images are displayed on film transparencies or in a

digital medium if image projection equipment is used. The latter approach is gaining

acceptance as the standard for image presentations.

Networking is almost a default function in any computer system in use today.

Because of the large amount of data inherent in image processing applications, the key

consideration in image transmission is bandwidth. In dedicated networks, this typically is not

a problem, but communications with remote sites via the Internet are not always as efficient.

Fortunately, this situation is improving quickly as a result of optical fiber and other

broadband technologies.

Page 6: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 6

3. How is image formed in an eye? Explain with examples the perceived brightness

is not a simple function of intensity. ( 10 Marks) , Jan 2010, July 2011,

Solution: The principal difference between the lens of the eye and an ordinary

optical lens is that the former is flexible. As illustrated in Fig. 2.1, the radius of

curvature of the anterior surface of the lens is greater than the radius of its posterior

surface. The shape of the lens is controlled by tension in the fibers of the ciliary

body.To focus on distant objects; the controlling muscles cause the lens to be

relatively flattened. Similarly, these muscles allow the lens to become thicker in

order to focus on objects near the eye. The distance between the center of the lens

and the retina (called the focal length) varies from approximately 17 mm to about 14

mm, as the refractive power of the lens increases from its minimum to its

maximum.When the eye focuses on an object farther away than about 3 m, the lens

exhibits its lowest refractive power.When the eye focuses on a nearby object, the

lens is most strongly refractive.This information makes it easy to calculate the size of

the retinal image of any object. In fig. for example, the observer is looking at a tree

15 m high at a distance of 100 m. If h is the height in mm of that object in the retinal

image, the geometry of Fig. 2.3 yields 15/100=h/17 or h=2.55 mm.The retinal image

is reflected primarily in the area of the fovea. Perception then takes place by the

relative excitation of light receptors, which transform radiant energy into electrical

impulses that are ultimately decoded by the brain.

Page 7: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 7

4. Explain the importance of brightness adaption in image processing.

( 05 Marks), Dec 2011, June 2012

Solution; The essential point in interpreting the impressive dynamic range depicted in Fig.

2.4 is that the visual system cannot operate over such a range simultaneously.Rather, it

accomplishes this large variation by changes in its overall sensitivity, a phenomenon known

as brightness adaptation. The total range of distinct intensity levels it can discriminate

simultaneously is rather small when compared with the total adaptation range. For any given

set of conditions, the current sensitivity level of the visual system is called the brightness

adaptation level, which may correspond, for example, to brightness Ba in Fig. 2.4.The short

intersecting curve represents the range of subjective brightness that the eye can perceive

when adapted to this level. This range is rather restricted, having a level Bb at and below

which all stimuli are perceived as indistinguishable blacks.The upper (dashed) portion of the

curve is not actually restricted but, if extended too far, loses its meaning because much

higher intensities would simply raise the adaptation level higher than Ba .

Page 8: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 8

Unit-2

1. Explain the concept of sampling and quantization of an image.

(10 Marks) July 2011, Jan 2010, June 2012

To create a digital image, we need to convert the continuous sensed data into digital form.

This involves two processes: sampling and quantization. A continuous image, f(x, y), that

we want to convert to digital form. An image may be continuous with respect to the x- and

y-coordinates, and also in amplitude. To convert it to digital form, we have to sample the

function in both coordinates and in amplitude. Digitizing the coordinate values is called

sampling. Digitizing the amplitude values is called quantization.

The one-dimensional function shown in Fig. 2.16(b) is a plot of amplitude (gray level)

values of the continuous image along the line segment AB. The random variations are due

to image noise. To sample this function, we take equally spaced samples along line AB, The

location of each sample is given by a vertical tick mark in the bottom part of the figure. The

samples are shown as small white squares superimposed on the function. The set of these

discrete locations gives the sampled function. However, the values of the samples still span

(vertically) a continuous range of gray-level values. In order to form a digital function, the

gray-level values also must be converted (quantized) into discrete quantities. The right side

gray-level scale divided into eight discrete levels, ranging from black to white. The vertical

tick marks indicate the specific value assigned to each of the eight gray levels. The

Page 9: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 9

continuous gray levels are quantized simply by assigning one of the eight discrete gray

levels to each sample. The assignment is made depending on the vertical proximity of a

sample to a vertical tick mark. The digital samples resulting from both sampling and

quantization.

2. Explain i) false contouring ii) checkboard pattern ( 06 marks), Jan 2010

The effect, caused by the use of an insufficient number of gray levels in smooth

areas of a digital image, is called false contouring, so called because the ridges resemble

topographic contours in a map. False contouring generally is quite visible in images

displayed using 16 or less uniformly spaced gray levels, As a very rough rule of thumb, and

assuming powers of 2 for convenience, images of size 256*256 pixels and 64 gray levels are

about the smallest images that can be expected to be reasonably free of objectionable

sampling checkerboards and false contouring.

3. How image is acquired using a single sensor? Discuss.

(06 Marks) Jan 2010, June 2012

Figure (a) shows the components of a single sensor. Perhaps the most familiar sensor of this

type is the photodiode, which is constructed of silicon materials and whose output voltage

waveform is proportional to light. The use of a filter in front of a sensor improves selectivity.

For example, a green (pass) filter in front of a light sensor favors light in the green band of

the color spectrum.

As a consequence, the sensor output will be stronger for green light than for other

components in the visible spectrum.

In order to generate a 2-D image using a single sensor, there has to be relative displacements

in both the x- and y-directions between the sensor and the area to be imaged.

Page 10: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 10

Figure 2.13 shows an arrangement used in high-precision scanning, where a film negative is

mounted onto a drum whose mechanical rotation provides displacement in one dimension.

The single sensor is mounted on a lead screw that provides motion in the perpendicular

direction.

Since mechanical motion can be controlled with high precision, this method is an

inexpensive (but slow) way to obtain high-resolution images.

4. Explain zooming of digital images. ( 04 Marks ), Dec 2011

This topic is related to image sampling and quantization because zooming may be

viewed as oversampling, while shrinking may be viewed as undersampling.The key

difference between these two operations and sampling and quantizing an original continuous

image is that zooming and shrinking are applied to a digital image. Zooming requires two

steps: the creation of new pixel locations, and the assignment of gray levels to those new

locations. Let us start with a simple example. Suppose that we have an image of size

500*500 pixels and we want to enlarge it 1.5 times to 750*750 pixels. Conceptually, one of

the easiest ways to visualize zooming is laying an imaginary 750*750 grid over the original

image. Obviously, the spacing in the grid would be less than one pixel because we are fitting

it over a smaller image. In order to perform gray-level

assignment for any point in the overlay, we look for the closest pixel in the original image

and assign its gray level to the new pixel in the grid.

When we are done with all points in the overlay grid, we simply expand it to the

original specified size to obtain the zoomed image. This method of gray-level assignment is

called nearest neighbor interpolation. special case of nearest neighbor interpolation. Pixel

replication is applicable when we want to increase the size of an image an integer number of

times. For instance, to double the size of an image, we can duplicate each column. This

doubles the image size in the horizontal direction.Then, we duplicate each row

of the enlarged image to double the size in the vertical direction.The same procedure is used

to enlarge the image by any integer number of times (triple, quadruple, and so on).

Duplication is just done the required number of times to achieve the desired size. The gray-

level assignment of each pixel is predetermined by the fact that new locations are exact

duplicates of old locations.

Page 11: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 11

5. Define 4-adjacency, 8 – adjacency and m – adjacency. ( 04 Marks) , Dec 2011

Solution: Connectivity between pixels is a fundamental concept that simplifies the

definition of numerous digital image concepts, such as regions and boundaries. To establish

if two pixels are connected, it must be determined if they are neighbors and if their gray

levels satisfy a specified criterion of similarity (say, if their gray levels are equal).For

instance, in a binary image with values 0 and 1, two pixels may be 4-neighbors, but they are

said to be connected only if they have the same value.

Let V be the set of gray-level values used to define adjacency. In a binary image,

V={1} if we are referring to adjacency of pixels with value 1. In a grayscale image, the idea

is the same, but set V typically contains more elements. For example, in the adjacency of

pixels with a range of possible gray-level values 0 to 255, set V could be any subset of these

256 values. We consider three types of adjacency:

(a) 4-adjacency. Two pixels p and q with values from V are 4-adjacent if q is in the

set N4(p).

(b) 8-adjacency. Two pixels p and q with values from V are 8-adjacent if q is in the

set N8(p).2.5

(c) m-adjacency (mixed adjacency).Two pixels p and q with values from V are m-

adjacent if

(i) q is in N4(p), or

(ii) q is in ND(p) and the set has no pixels whose values are from V.

Mixed adjacency is a modification of 8-adjacency.

6. With a suitable diagram, explain how an image is acquired using a circular sensor

strip. ( 06 Marks) , Dec 2011

Solution : A geometry that is used much more frequently than single sensors consists of an

in-line arrangement of sensors in the form of a sensor strip, shows. The strip provides

imaging elements in one direction. Motion perpendicular to the strip provides imaging in the

other direction, This is the type of arrangement used in most flat bed scanners. Sensing

devices with 4000 or more in-line sensors are possible. In-line sensors are used routinely in

airborne imaging applications, in which the imaging system is mounted on an aircraft that

flies at a constant altitude and speed over the geographical area to be imaged. One-

Page 12: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 12

dimensional imaging sensor strips that respond to various bands of the electromagnetic

spectrum are mounted perpendicular to the direction of flight. The imaging strip gives one

line of an image at a time, and the motion of the strip completes the other dimension of a

two-dimensional image. Lenses or other focusing schemes are used to projectbthe area to be

scanned onto the sensors.Sensor strips mounted in a ring configuration are used in medical

and industrial imaging to obtain cross-sectional (―slice‖) images of 3-D objects\

7. Consider image segment shown below:

i) Let V={0,1} and compute the length of the shortest 4,8 and m-path between p and

q, if a particular path does not exit between those two point explain why.

ii) Repeat for V={1,2} ( 06 Marks), July 2011, Dec

2011

3 1 2 1 (q)

2 2 0 2

1 2 1 1

( p ) 1 0 1 2

Solution

When V = {0; 1}, 4path does not exist between p and q

The shortest 8 path is shown in Fig.(b) its length is 4.

In this case the length of shortest m path is 5.

For the shortest 4 path when V = {1; 2} is shown in Fig.(c) its length is 6.

One possibility for the shortest 8 path (it is not unique) is shown in Fig.(d) its length is 4.

The length of a shortest m path is 6.

Page 13: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 13

8. Find D8 and Dm for the following @-D section with V = { 0, 1} and V = { 1, 2} between p

and q. ( 05 Marks) , June 2012

5 4 3 1 1 (q)

5 4 0 2 0

3 2 0 2 4

2 1 1 3 5

( p) 1 3 5 1 3

Solution:

Page 14: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 14

9. Explain some of the widely used gray-level transformation. ( 10 Marks), Dec 2010

Solution:

Gray level mapping

The appearance of an image can be modified according to various needs by a gray level

mapping function Y = f ( x)

where is a pixel in the input image and is the corresponding pixel in the output image. This

mapping function can be specified in different ways, such as a piecewise linear function, or

based on the histogram of the input image.

The histogram of an image shows the distribution of the pixel values in the image over the

dynamic range, typically from to for a 8-bit image. The ith item of the

histogram is ( ) represents the probability of the a

randomly chosen pixel has the gray level , where is the number of pixels of gray

level , and is the total number of pixels in the image.

Piecewise linear mapping:

A mapping function can be specified by a set of break points , with neighboring points

connected by straight lines, such as shown here:

Page 15: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 15

For example, on the left of the image below is a microscopic image of some onion cells.

Piecewise linear mapping is applied to stretch the dynamic range for the cells (dark) and to

compress the background (bright).

Thresholding:

As a special case of piecewise linear mapping, thresholding is a simple way to do image

segmentation, in particular, when the histogram of the image is bimodal with two peaks

separated by a valley, typically corresponding to some object in the image and the

background. A thresholding mapping maps all pixel values below a specified threshold to

zero and all above to 255.

Page 16: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 16

Negative image:

This mapping is shown below which generates the negative of the input image:

Page 17: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 17

Example:

Min-max linear stretch:

This is a piecewise linear mapping between the input and output images of three linear

segments with slopes 0 for ,

for , and 0 for . The greater than 1 slope in the middle

range stretches the dynamic range of the image to use all gray levels available in the display.

Page 18: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 18

Example:

Linear stretch based on histogram:

If in the image there are only a small number of pixels close to minimum gray level 0 and

the maximum gray level , and the gray level of most of the pixels are

concentrated in the middle range (gray) of the histogram, the above linear stretch method based on the minimum and maximum gray levels has very limited effect (as the

slope is very close to 1). In this case we can push a small

percentage (e.g., , ) of gray levels close to the two ends of the histogram toward

Page 19: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 19

Or

Linear function

– Negative and identity transformations

● Logarithm function

– Log and inverse-log transformations

● Power-law function

– nth power and nth root transformations

Page 20: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 20

Unit – 3

1. Define two-dimensional DFT. Explain any four properties of 2-DFT.

(10 Marks), Dec 2011, Jan 2010, Jan 2012

Solution:

If f x y( , ) is an NM array, such as that obtained by sampling a continuous function of

two dimensions at dimensions NM and on a rectangular grid, then its two dimensional

Discrete Fourier transform (DFT) is the array given by

1

0

1

0

)//(2),(1

),(M

x

N

y

NvyMuxjeyxfMN

vuF , where 1,,0 Mu , 1,,0 Nv

The properties of the DFT are similar to those of the discrete Fourier series. The key

difference is that the support of the sequence x and of the DFT X is finite. We consider two

sequences x and y with the same rectangular support, having DFT transforms X

and Y, respectively. We then offer proofs of some of these properties below.

• Linearity:

when both sequences have the same support

• Circular convolution :

We define circular convolution for two finite support sequences with the same period as

Using the operator symbol . We then the following transform pair:

.

• Multiplication:

.

• Separability:

Page 21: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 21

,

the separable product of a 1-D N1 -point and N2 -point DFT.

• Circular shifting:

where the shift vector is integer

valued.

2. Derive the expression for 2D circular convolution theorem.

( 10 Marks) , July 2011

Solution:

Multiplication of 2-D DFTs corresponds to the defined circular convolution in the spatial

domain, in a manner very similar to that in one dimension. In fact, we can see from (4.2.3)

that this operation is separable into a 1-D circular convolution along the rows, followed by a

1-D circular convolution over the columns. The correctness of this property can then be

proved by making use of the 1-D proof twice, once for the rows and once for the columns.

Proof of DFT Circular Property

Since , it follows that the periodic shift of agrees with

the circular shift of x,

for , so the DFS of the left-hand side must equal the DFT

of the right-hand side, over the fundamental period in frequency, i.e.,

. We have thus have the DFT

Page 22: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 22

Figure( 4.4): Example of 2D Circular Convolution

Page 23: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 23

3. Define two – dimensional unitary transform. Check whether the unitary DFT matrix is

unitary or not for N = 4. ( 06 Marks), Jan 2010

Solution : As a one dimensional signal can be represented by an orthonormal set of basis

vectors, an image can also be expanded in terms of a discrete set of basis arrays called

basis images through a two dimensional (image) transform.

For an N N image f x y( , ) the forward and inverse transforms are given below

4. 1

0

1

0

),(),,,(),(N

x

N

y

yxfyxvuTvug

5. 1

0

1

0

),(),,,(),(N

u

N

v

vugvuyxIyxf

where, again, ),,,( yxvuT and ),,,( vuyxI are called the forward and inverse

transformation kernels, respectively.

4. Explain the histogram equation technique for image enhancement. Also give the digital

formation for the same ( 08 Marks), Jan 2011

Solution:

Contrast Limited Adaptive Histogram Equalization method:

Algorithm Steps:

1. Obtain all the inputs: Image, Number of regions in row and column directions, Number of

bins for the histograms used in building image transform function (dynamic range), Clip

limit for contrast limiting (normalized from 0 to 1)

2. Pre-process the inputs: Determine real clip limit from the normalized value if necessary,

pad the image before splitting it into regions

3. Process each contextual region (tile) thus producing gray level mappings: Extract a single

image region, make a histogram for this region using the specified number of bins, clip the

histogram using clip limit, create a mapping (transformation function) for this region

4. Interpolate gray level mappings in order to assemble final CLAHE image: Extract cluster

of four neighbouring mapping functions, process image region partly overlapping each of the

mapping tiles, extract a single pixel, apply four mappings to that pixel, and interpolate

Page 24: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 24

between the results to obtain the output pixel; repeat over the entire image.

Dynamic histogram equalization for image contrast enhancement:

Algorithm Steps:

1. Histogram Partition : DHE partitions the histogram based on local minima. At first, it

applies a one-dimensional smoothing filter of size 1 x 3 on the histogram to get rid of

insignificant minima. Then it makes partitions (sub-histograms) taking the portion of

histogram that falls between two local minima (the first and the last non-zero histogram

components are considered as minima). Mathematically, if m0, m1, …, mn are (n+1) gray

levels (GL) that correspond to (n+1) local minima in the image histogram, then the first sub-

histogram will take the histogram components of the GL range [m0, m1], the second one

will take [m1+1, m2] and so on.These histogram partitioning helps to prevent some parts of

the histogram from being dominated by others.

2. Gray Scale Allocation: For each sub-histogram, DHE allocates a particular range of GLs

over which it may span in output image histogram. This is decided mainly based on the ratio

of the span of gray levels that the sub-histograms occupy in the input image histogram. Here

the straightforward approach is

Spani= mi-mi-1

Page 25: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 25

where, spani = dynamic GL range used by sub-histogram i in input image.

mi = ith local minima in the input image histogram.

rangei = dynamic gray level range for sub-histogram i in output image.

The order of gray levels allocated for the sub-histograms in output image histogram are

maintained in the same order as they are in the input image, i.e., if sub-histogram i is

allocated the gray levels from [istart, iend],

then istart = (i-1)end + 1 and iend= istart + rangei.

For the first sub-histogram, j, jstart = r0.

3. Histogram Equalization : Conventional HE is applied to each sub-histogram, but its span

in the output image histogram is allowed to confine within the allocated GL range that is

designated to it. Therefore, any portion of the input image histogram is not allowed to

dominate in HE.

Page 26: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 26

Unit-4

1. Explain Hadamard transform and its application. ( 10 Marks), Dec 2010

The Hadamard transform and the Haar transform, to be considered in the next section, share

a significant computational advantage over the previously considered DFT, DCT, and DST

transforms. Their unitary matrices consist of and the transforms are computed via

additions and subtractions only, with no multiplications being involved. Hence, for

processors for which multiplication is a time-consuming operation a sustained saving is

obtained.The Hadamard unitary matrix of order n is the matrix , generated

by the following iteration rule:

(4.5.1)

Where (4.5.2)

And denotes the Kronecker product of two matrices .

where A(i,j) is the (i,j) element of A,i,j=1,2...,N.. Thus, according to (4.5.1), (4.52) it

is

And for

Page 27: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 27

It is not difficult to show the orthogonality of , that is,

For a vector x of N samples and , the transform pair is

The 2-D Hadamard tansform is given by

The Hadamard transform has good to very good energy packing properties. Fast algorithms

for its computation in subtractions and/or additions are also available.

2. Compute the Discrete Cosine Transform (DCT) matrix for N= 4

( 10 Marks), Dec 2010. June 2012

Solution:

Page 28: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 28

3. Write four properties of Hadamard transform.

( 06 Marks), June 2012, Dec 2011, July 2011

Solution:

The Hadamard transform and the Haar transform, share a significant computational

advantage over the previously considered DFT, DCT, and DST transforms. Their unitary

matrices consist of and the transforms are computed via additions and subtractions only,

with no multiplications being involved. Hence, for processors for which multiplication is a

time-consuming operation a sustained saving is obtained.

The Hadamard unitary matrix of order n is the matrix , generated by the

following iteration rule:

(4.5.1)

where

(4.5.2)

And denotes the Kronecker product of two matrices .

Page 29: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 29

where A(i,j) is the (i,j) element of A,i,j=1,2...,N.. Thus, according to (4.5.1), (4.52) it is

And for

It is not difficult to show the orthogonality of , that is,

For a vector x of N samples and , the transform pair is

The 2-D Hadamard tansform is given by

The Hadamard transform has good to very good energy packing properties. Fast algorithms

for its computation in subtractions and/or additions are also available.

Page 30: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 30

3. Define Hadamard transform and Harr transform for N=4 (12 Marks), Jan 2010

Solution:

As any orthogonal (unitary) matrix can be used to define an orthogonal (unitary)

transform, we define a Walsh-Hadamard transform of Hadamard order ( )

as

These are the forward and inverse transform pair.

Here

and are the signal and spectrum vectors,

respectively. The th element of the transform can also be written as

The complexity of WHT is . Similar to FFT algorithm, we can derive a fast

WHT algorithm with complexity of . We will assume

and in the following derivation. An point of

signal is defined as

This equation can be separated into two parts. The first half of the vector can be obtained as

Page 31: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 31

(1)

where

(2)

The second half of the vector can be obtained as

(3)

where

(4)

What we have done is converting a of size into two

of size . Continuing this process recursively, we can rewrite Eq. (1) as the following (similar process for Eq. (3))

This equation can again be separated into two halves. The first half is

(5)

where

(6)

The second half is

Page 32: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 32

where

through of the second half can be obtained similarly.

and

Summarizing the above steps of Equations (2), (4), (6), (8), (9) and (10), we get the Fast

WHT algorithm as illustrated below.

(7)

(8)

(9)

(10)

Page 33: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 33

4. Write H matrix for the Haar transform for N = 4, 8 and explain how it is constructed.

( 05 Marks), July 2011

Solution:

The N Haar functions can be sampled at ,

where to form an by matrix for discrete Haar

transform. For example, when , we have

and when

The Haar transform matrix is real and orthogonal:

where is identity matrix. For example, when ,

In general, an N by N Haar matrix can be expressed in terms of its row vectors:

Page 34: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 34

where is the nth row vector of the matrix. The Haar tansform of a given signal

vector is

with the n-th component of being

which is the nth transform coefficient, the projection of the signal vector onto the n-th

row vector of the transform matrix. The inverse transform is

i.e., the signal is expressed as a linear combination of the row vectors of .

Comparing this Haar transform matrix with all transform matrices previously discussed (e.g.,

Fourier transform, cosine transform, Walsh-Hadamard transform), we see an essential

difference. The row vectors of all previous trnasform methods represent different frequency

(or sequency) components, including zero frequency or the average or DC component (first

row ), and the progressively higher frequencies (sequencies) in the subsequent rows

( ). However, the row vectors in Haar transform matrix represent

progressively smaller scales (narrower width of the square waves) and their different

positions. It is the capability to represent different positions as well as different scales

(corresponding different frequencies) that distinguish Haar transform from the previous

transforms. This capability is also the main advantage of wavelet transform over other

orthogonal transforms.

Page 35: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 35

Unit-5

1. What is the importance of image enhancement in image processing? Explain in brief

any two point processing techniques implemented in image processing.

( 10 Marks), June 2012, Jan 2010

Solution:

Intensity transformations

Image Negatives

The negative of a digital image is obtained by the transformation function

rLrTs 1)( shown in the following figure, where L is the number of grey levels.

The idea is that the intensity of the output image decreases as the intensity of the input

increases. This is useful in numerous applications such as displaying medical images.

Contrast Stretching

contrast images occur often due to poor or non uniform lighting conditions, or due to

nonlinearity, or small dynamic range of the imaging sensor. In the figure of Example 1

above you have seen a typical contrast stretching transformation.

Histogram processing. Definition of the histogram of an image.

By processing (modifying) the histogram of an image we can create a new image with

specific desired properties.

Suppose we have a digital image of size NN with grey levels in the range ]1,0[ L . The

histogram of the image is defined as the following discrete function:

2

)(N

nrp kk

Where kr is the thk grey level, 1,,1,0 Lk

1L

1L

)(rTs

r

Page 36: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 36

kn is the number of pixels in the image with grey level kr

2N is the total number of pixels in the image

The histogram represents the frequency of occurrence of the various grey levels in the

image. A plot of this function for all values of k provides a global description of the

appearance of the image.

\ 2. Explain histogram equalization technique. ( 10 Marks) Jan 2010,

Solution:

Global histogram equalisation

In this section we will assume that the image to be processed has a continuous intensity that

lies within the interval ]1,0[ L . Suppose we divide the image intensity with its maximum

value 1L . Let the variable r represent the new grey levels (image intensity) in the image,

where now 10 r and let )(rpr denote the probability density function (pdf) of the

variable r . We now apply the following transformation function to the intensity

r

r dwwprTs0

)()( , 10 r

(1) By observing the transformation of equation (1) we immediately see that it possesses the

following properties:

(i) 10 s .

(ii) )()( 1212 rTrTrr , i.e., the function )(rT is increase ng with r .

(iii) 0)()0(0

0

dwwpTs r and 1)()1(1

0

dwwpTs r . Moreover, if the original

image has intensities only within a certain range ] ,[ maxmin rr then

0)()(min

0min

r

r dwwprTs and 1)()(max

0max

r

r dwwprTs since

maxmin and ,0)( rrrrrpr . Therefore, the new intensity takes always all values within

the available range [0 1].

Suppose that )(rPr , )(sPs are the probability distribution functions (PDF‘s) of the variables

r and s respectively.

Page 37: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 37

Let us assume that the original intensity lies within the values r and drr with dr a small

quantity. dr can be assumed small enough so as to be able to consider the function )(wpr

constant within the interval ],[ drrr and equal to )(rpr . Therefore,

drrpdwrpdwwpdrrrP r

drr

rr

drr

rrr )()()(],[ .

Now suppose that )(rTs and )(1 drrTs . The quantity dr can be assumed small

enough so as to be able to consider that dsss1 with ds small enough so as to be able to

consider the function )(wps constant within the interval ],[ dsss and equal to )(sps .

Therefore,

dsspdwspdwwpdsssP s

dss

ss

dss

sss )()()(],[

Since )(rTs , )( drrTdss and the function of equation (1) is increasing with r , all

and only the values within the interval ],[ drrr will be mapped within the interval

],[ dsss . Therefore,

],[],[ dsssPdrrrP sr

)(

)(

1

1

)()()()(sTr

rss

sTr

rds

drrpspdsspdrrp

From equation (1) we see that

)(rpdr

dsr

and hence,

10 ,1)(

1)()(

)(1

srp

rpsp

sTrr

rs

Page 38: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 38

4. What is histogram matching (specification)? Explain the development and

implementation of the method.

( 10 Marks), Dec 2011

Solution:

Here we want to convert the image so that it has a particular histogram as specified. First

consider equalization transform of the given image :

If the desired image were available, it could also be equalized:

where is the desired histogram. The inverse of the above transform is

Since images and have the same equalized histogram, they are actually the same

image and the overall transform from the given image to the desired image can be

found as:

where both and can be found from the histogram of the given image and the

desired histogram, respectively.

Page 39: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 39

Step 1: Find histogram of input image , and find histogram equalization mapping:

Step 2: Specify the desired histogram , and find histogram equalization mapping:

Step 3: Build lookup table:

For each gray level , find and then find a level so that best

matches :

.

5. Perform histogram equalization for the following image data, sketch the histogram of

the original image and histogram of equalized image. ( 10

Marks)

Solution:

Page 40: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 40

6. Explain the following image enhancement techniques, highlighting their area of

application. ( 10 Marks), Dec 2011, July 2011

i) Intensity level slicing

ii) Power – law transformation

Solution: i) Highlighting a specific range of gray levels in an image often is desired.

Applications include enhancing features such as masses of water in satellite imagery and

enhancing flaws in X-ray images.There are several ways of doing level slicing, but most of

them are variations of two basic themes.One approach is to display a high value for all gray

levels in the range of interest and a low value for all other gray levels.This transformation,

shown in Fig. 3.11(a), produces a binary image.The second approach, based on the

transformation shown in Fig. 3.11(b), brightens the desired range of gray levels but

preserves the background and gray-level tonalities in the image. Figure 3.11(c) shows a

Page 41: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 41

gray-scale image, and Fig. 3.11(d) shows the result of using the transformation in Fig.

3.11(a).Variations

of the two transformations shown in Fig. 3.11 are easy to formulate.

(a) (b)

© (d)

ii) Power – law transformation

Basic form (1)

where C and r are +ve constants

As in log transformation, power- law curves with

Figure(5.16)

Page 42: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 42

For —> maps a narrow range of dark i/p values into a wider range of o/p values and

with the opposite being true for higher values of i/p. By varying we obtain a family of

possible transformation:

For curves generated with values —>effect is opposite to . Finally the

transformation (1) reduces to identity transformation for

A variety of devices for image capture, printing, and display respond according to a power

law. The exponent in power law equation is referred to as gamma Þ process used to correct

this power law response phenomena is called gamma correction. eg. CRT devices have

intensity.. vs voltage response as a power function with varying from 1.8 to 2.5. With

=2.5, the CRT would produce images darker than intended. eg. i/p is a simple gray scale

linear wedge .To reproduce colors accurately also requires knowledge of gamma correction

as changing the value of gamma changes not only the brightness but also the color ratios of

R:G:B.

Gamma correction is extremely important as use of digital images for commercial purposes

over the internet has increased.

Page 43: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 43

Figure(5.17)

7. Explain the following image enhancement techniques, highlighting their area of

application. (10 Marks), July 2011

i) Bit – plane slicing.

ii) AND and OR operation

Solution: i ) Instead of highlighting gray level images, highlighting the contribution made

to total image appearance by specific bits might be desired. Suppose that each pixel in an

image is represented by 8 bits. Imagine the image is composed of 8, 1-bit planes ranging

from bit plane1-0 (LSB)to bit plane 7 (MSB).

In terms of 8-bits bytes, plane 0 contains all lowest order bits in the bytes comprising the

pixels in the image and plane 7 contains all high order bits.

Figure (5.15)

Page 44: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 44

Separating a digital image into its bit planes is useful for analyzing the relative

importance played by each bit of the image, implying, it determines the adequacy of

numbers of bits used to quantize each pixel , useful for image compression.

In terms of bit-plane extraction for a 8-bit image, it is seen that binary image for bit

plane 7 is obtained by proceeding the input image with a thresholding gray-level

transformation function that maps all levels between 0 and 127 to one level (e.g

0)and maps all levels from 129 to 253 to another (eg. 255).

As an exercise obtain gray-level transformation functions that would yield other bit

planes.

ii) Logic operations similarly operate on a pixel-by-pixel basis†.We need only be concerned

with the ability to implement the AND, OR, and NOT logic operators because these three

operators are functionally complete. In other words, any other logic operator can be

implemented by using only these three basic functions.When dealing with logic operations

on gray-scale images, pixel values

are processed as strings of binary numbers. For example, performing the NOT operation on a

black, 8-bit pixel (a string of eight 0‘s) produces a white pixel (a string of eight 1‘s).

Intermediate values are processed the same way, changing all 1‘s to 0‘s and vice versa.Thus,

the NOT logic operator performs the same function as the negative transformation of Eq.

(3.2-1). The AND and OR operations are used for masking; that is, for selecting subimages

in an image, as illustrated

in Fig. 3.27. In the AND and OR image masks, light represents a binary 1 and dark

represents a binary 0. Masking sometimes is referred to as region of interest (ROI)

processing. In terms of enhancement, masking is used primarily to isolate an area for

processing.This is done to highlight that area and differentiate it from the rest of the image.

Logic operations also are used frequently

in conjunction with morphological operations.

Page 45: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 45

(a) Fig. 3.27 (b) (c)

(d) (e) (f)

Fig. 3.27

Page 46: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 46

Unit-6

1. Explain the smoothing of images in frequency domain using:

i) Ideal low pass filter

ii) Butterworth lowpass filter ( 10 Marks), Dec 2011

Solution: Smoothing (blurring) is achieved in the frequency domain by lowpass filtering.

A 2-D lowpass filter that passes all frequencies within a circle of radius D0 from the origin

and ―cuts off‖ all frequencies outside this circle is called an ideal lowpass filter (ILPF). It is

specified by the function

where D0 is a positive constant, and D u v ( , )is the distance between a point ( , ) u v in the

frequency domain and the center of the frequency rectangle

where M and N are the padded sized from

M ≥ − 2p- 1 (4.6-31)

and N ≥ − 2q-1. (4.6-32)

For an ILPF cross section, the point of transition between H (u, v)= 1 and H (u, v) =0 is

called the cutoff frequency.

For example, the cutoff frequency is D0 in Figure One way to establish a set of standard

cutoff frequency loci is to compute circles that enclose specified amounts of total image

power PT . It can be obtained by summing the components of the power spectrum of the

padded images at each point ( u, v)

Page 47: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 47

The transfer function of a Butterworth lowpass filter (BLPF) of order n , and with cutoff

frequency at a distance D0 from the origin, is defined as

where D (u, v) is given by

Figure shows a perspective plot, image display, and radial cross sections of the BLPF

function.

2. With a block diagram and equations, explain the homomorphic filtering. How

dynamic range compression and contrast enhancement is simultaneously

achieved?

( 10 Marks), Dec 2011, July 2011

Solution:

Page 48: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 48

Page 49: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 49

and

3. Explain the basic concept of spatial filtering in image enhancement and hence explain

the importance of smoothing filters and median filters. (10 Marks) Jan 2010

Solution:

A 33 spatial mask operating on an image can produce (a) a smoothed version of the image

(which contains the low frequencies) or (b) it can enhance the edges and suppress essentially

the constant background information. The behaviour is basically dictated by the signs of the

elements of the mask.

Let us suppose that the mask has the following form

a

b

c

d

1

e

f

g

h

To be able to estimate the effects of the above mask with relation to the sign of the

coefficients hgfedcba ,,,,,,, , we will consider the equivalent one dimensional mask

d

1

e

Let us suppose that the above mask is applied to a signal )(nx . The output of this operation

will be a signal

)(ny as )()()()()1()()1()( 1 zezXzXzXdzzYnexnxndxny

)()1()( 1 zXezdzzY ezdzzHzX

zY1)(

)(

)( 1.

Page 50: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 50

This is the transfer function of a system that produces the above input-output relationship. In

the frequency domain we have

)exp(1)exp()( jejdeH j .

The values of this transfer function at frequencies 0 and are:

edeH j 1)(0

edeH j 1)(

If a lowpass filtering (smoothing) effect is required then the following condition

must hold

0)()(0

edeHeH jj

Gaussian filtering

The two dimensional Gaussian mask has values that attempts to approximate the continuous

function

2

22

22

1),(

yx

eyxG

In theory, the Gaussian distribution is non-zero everywhere, which would require an

infinitely large convolution kernel, but in practice it is effectively zero more than about three

standard deviations from the mean, and so we can truncate the kernel at this point. The

following shows a suitable integer-valued convolution kernel that approximates a Gaussian

with a of 1.0.

Median filtering

The median m of a set of values is the value that possesses the property that half the values

in the set are less than m and half are greater than m . Median filtering is the operation that

replaces each pixel by the median of the grey level in the neighbourhood of that pixel.

273

1

26

4

7

4

1

7

26

41

16

26

16

4

4

16

26

16

1

4

7

4

7

4

1

4

1

Page 51: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 51

Median filters are non linear filters because for two sequences )(nx and )(ny

)(median)(median)()(median nynxnynx

Median filters are useful for removing isolated lines or points (pixels) while preserving

spatial resolutions. They perform very well on images containing binary (salt and pepper)

noise but perform poorly when the noise is Gaussian. Their performance is also poor when

the number of noise pixels in the window is greater than or half the number of pixels in the

window

4. Write short notes on Weiner filtering and inverse filtering ( 10 Marks), June 2012

Solution: Inverse filtering

The objective is to minimize

22

)()( HfyfnfJ

We set the first derivative of the cost function equal to zero

0)(20)(

HfyHf

f TJ

yHHHfT-1T )(

If NM and 1

H exists then

yHf-1

According to the previous analysis if H (and therefore -1

H ) is block circulant the above

problem can be solved as a set of NM scalar problems as follows

Isolated

point Median filtering

0

0 0

0

0

0

0

0

0

0

1 0

0

0

0

0

0

0

Page 52: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 52

2

1

2),(

),(),(),(

),(

),(),(),(

vuH

vuYvuHjif

vuH

vuYvuHvuF

(I) Suppose first that the additive noise ),( jin is negligible. A problem arises if ),( vuH becomes

very small or zero for some point ),( vu or for a whole region in the ),( vu plane. In that

region inverse filtering cannot be applied. Note that in most real applications ),( vuH drops

off rapidly as a function of distance from the origin. The solution is that if these points are

known they can be neglected in the computation of ),( vuF .

(II) In the presence of external noise we have that

2),(

),(),(),(),(ˆ

vuH

vuNvuYvuHvuF

22),(

),(),(

),(

),(),(

vuH

vuNvuH

vuH

vuYvuH

),(

),(),(),(ˆ

vuH

vuNvuFvuF

If ),( vuH becomes very small, the term ),( vuN dominates the result. The solution is again

to carry out the restoration process in a limited neighborhood about the origin where ),( vuH

is not very small. This procedure is called pseudoinverse filtering. In that case we set

TvuH

TvuHvuH

vuYvuH

vuF

),(0

),(),(

),(),(

),(ˆ

2

The threshold T is defined by the user. In general, the noise may very well possess large

components at high frequencies ),( vu , while ),( vuH and ),( vuY normally will be

dominated by low frequency components.

Page 53: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 53

Wiener filter

Page 54: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 54

Unit-7

1. Explain the importance process in image restoration process in image

processing. Explain any four important noise probability density functions.

(10 Marks), Jan 2010

Solution:

Image Restoration refers to a class of methods that aim to remove or reduce the degradations

that have occurred while the digital image was being obtained. All natural images when

displayed have gone through some sort of degradation:

during display mode

during acquisition mode, or

during processing mode

The degradations may be due to

sensor noise

blur due to camera misfocus

relative object-camera motion

random atmospheric turbulence

others

In most of the existing image restoration methods we assume that the degradation process

can be described using a mathematical model.

Image restoration and image enhancement differences

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.

Typical parts of an imaging system: image formation system, a detector and a recorder. A

general model for such a system could be:

),(),(),( jinjiwrjiy

Page 55: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 55

jdidjifjijihjifHjiw ),(),,,(),(),(

),(),()],([),( 21 jinjinjiwrgjin

where ),( jiy is the degraded image, ),( jif is the original image and ),,,( jijih is an

operator that represents the degradation process, for example a blurring process. Functions

g and r are generally nonlinear, and represent the characteristics of detector/recording

mechanisms. ),( jin is the additive noise, which has an image-dependent random component

),()],([ 1 jinjifHrg and an image-independent random com

Noise Model

• The principal sources of noise in digital images arise during image acquisition

(digitization) and/or transmission.

• Two common assumptions in Spatial and Frequency Properties of Noise:

Noise is independent of spatial coordinates and it is uncorrelated with respect to the image

itself (that is, there is no correlation between pixel values and the values of noise

components)

The Fourier spectrum of noise is constant (The noise usually is called white noise)

component ),(2 jin .

Important Noise Probability Density Functions

Gaussian noise is typical in sensors, especially in low lighting conditions

Impulse (salt-and-pepper) noise comes from disturbed switching devices Silver halide

grains in photographic films yield lognormal distributions

Rayleigh noise arises in range images

Exponential noise is present in laser imaging

Page 56: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 56

Page 57: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 57

Applications of Noise Probability Density Functions

1. Gaussian Noise arises in images due to electronic circuit noise and sensor noise.

2. Rayleigh density is helpful in characterizing noise phenomena in range imaging.

3. The exponential and gamma densities find application in laser imaging.

4. Impulse noise is found in situations where quick transients take place during imaging.

5. Uniform density is useful as the basis for numerous random number generators that are

used in simulations

2. Discuss the importance of adaptive filters in image restoration system. Highlight the

working of adaptive median filters. (10 Marks), Jan 2010, July 2011

Solution

The adaptive median filtering has been applied widely as an advanced method compared

with standard median filtering. The Adaptive Median Filter performs spatial processing to

determine which pixels in an image have been affected by impulse noise. The Adaptive

Median Filter classifies pixels as noise by comparing each pixel in the image to its

surrounding neighbor pixels. The size of the neighborhood is adjustable, as well as the

threshold for the comparison. A pixel that is different from a majority of its neighbors, as

well as being not structurally aligned with those pixels to which it is similar, is labeled as

impulse noise. These noise pixels are then replaced by the median pixel value of the pixels in

the neighborhood that have passed the noise labeling test.

The Adaptive Median Filter is designed to eliminate the problems faced with the standard

median filter. The basic difference between the two filters is that, in the Adaptive Median

Filter, the size of the window surrounding each pixel is variable. This variation depends on

the median of the pixels in the present window. If the median value is an impulse, then the

size of the window is expanded. Otherwise, further processing is done on the part of the

image within the current window specifications. ‗Processing‘ the image basically entails the

following: The center pixel of the window is evaluated to verify whether it is an impulse or

not. If it is an impulse, then the new value of that pixel in the filtered image will be the

median value of the pixels in that window. If, however, the center pixel is not an impulse,

then the value of the center pixel is retained in the filtered image. Thus, unless thepixel being

considered is an impulse, the gray-scale value of the pixel in the filtered image is the same as

Page 58: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 58

that of the input image. Thus, the Adaptive Median Filter solves the dual purpose of

removing the impulse noise from the image and reducing distortion in the image. Adaptive

Median Filtering can handle the filtering operation of an image corrupted with impulse noise

of probability greater than 0.2. This filter also smoothens out other types of noise, thus,

giving a much better output image than the standard median filter.

Purpose

1). Remove impulse noise

2). Smoothing of other noise

3). Reduce distortion, like excessive thinning or thickening of object boundaries

Advantages

The standard median filter does not perform well when impulse noise is

a. Greater than 0.2, while the adaptive median filter can better handle these noises.

b. The adaptive median filter preserves detail and smooth non-impulsive noise, while the

standard median filter does not. See example form a) to d)

c.

in figure 6.

a) Image corrupted by impulse noise b) Result of arithmetic mean filtering;

with a probability of 0.1;

c) Result of adaptive median filtering; d) Result of standard median filtering

Page 59: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 59

3. How do you reduce the periodic noise using frequency domain filters?

(06 Marks) July 2011

Solution:

Periodic noise can be analyzed and filtered effectively by using frequency domain techniques.

Bandreject Filters

Figure 5.15 shows perspective plots of ideal, Butterworth, and Gaussian bandreject filters,

One of the principal applications of bandreject filtering is for noise removal in applications

where the general location of the noise component(s) in the frequency domain is

approximately known.

Example 5.6: Use of Bandreject filtering for periodic noise removal Figure 5.16 (a), which is

the same as Figure 5.5 (a), shows an image corrupted by sinusoidal noise of various

frequencies.

The noise components can be seen as symmetric pairs of bright dots in the Fourier spectrum

shown in Figure 5.16 (b). Since the component lie on an approximate circle about the origin

of the transform, so a circularly symmetric bandreject filter is a good choice.

Page 60: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 60

Bandpass Filters

A bandpass filter performs the opposite operation of a bandreject filter. The transfer

function

H BP (u, v) of a bandpass filter is obtained from a corresponding bandreject filter transfer

function

H BR (u, v) by using the equation

Performing straight bandpass filtering on an image is not a common procedure because it

generally removes too much image detail. However, bandpass filtering is useful in isolating

the effects on an

image caused by selected frequency bands.

Notch Filters

A notch filter rejects/passes frequencies in predefined neighbourhoods about a center

frequency. Figure 5.18 shows plots of ideal, Butterworth, and Gaussian notch (reject) filters.

Similar to (5.4-4), the transfer function H NP (u, v) of a notch pass filter is obtained from a

corresponding notch reject filter transfer function,H NR( ,u v) by using the equation

H NP (u, v) = 1 − . H NR( ,u v) (5.4-5)

Page 61: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 61

4. Derive the expression for observed image when the degradations are linear position

invariant. ( 08 Marks) July 2011

Solution: consider the general degradation model

),(),(),( jinjifHjiy

If we ignore the presence of the external noise ),( jin we get

),(),( jifHjiy

H is linear if

),(),(),(),( 22112211 jifHkjifHkjifkjifkH

H is position (or space) invariant if

),(),( bjaiybjaifH

From now on we will deal with linear, space invariant type of degradations.

In a real life problem many types of degradations can be approximated by linear, position

invariant processes.

Advantage: Extensive tools of linear system theory become available.

Disadvantage: In some real life problems nonlinear and space variant models would be

more appropriate for the description of the degradation phenomenon.

5. With a block diagram, briefly explain the image model of degradation- restoration

process. ( 06 Marks), Dec2010

Solution:

Image restoration methods are used to improve the appearance of an image by application of

a restoration process that uses a mathematical model for image degradation.

Examples of the types of degradation include:

- geometric distortion caused by imperfect lenses,

- superimposed interference patterns caused by mechanical systems,

- noise from electronic sources.

In practice the degradation process model is often not known and must be experimentally

determined or estimated. Any available information regarding the images and the systems

used to acquire and process them is helpful. This information, combined with the developer's

experience, can be applied to solve the specific application.

Page 62: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 62

Spatial domain

g(x, y) = h(x, y) ∗ f(x, y) + η(x, y)

Frequency domain

G(u, v) = H(u, v) F(u, v) + N(u, v)

H(u, v): Degradation function, η(x, y): Additive noise term

The objective is to find an estimateˆf(x, y) of the original image f(x, y). The more we know

about H and η, the closer ˆf(x, y) will be to ˆf(x, y).

6. Discuss various mean filters and order ststistics filters in image restoration system

( 10 Marks), June 2012

Solution: The mean filters function by finding some form of an average within the N x N

window, using the sliding window concept to process the entire image. The most basic of

these filters is the arithmetic mean filter, which finds the arithmetic average of the pixel

values in the window, as follows:

Arithmetic Mean =

The arithmetic mean filter smooth out local variations within an image, so it essentially a

lowpass filter. This type of filter will tend to blur a image while mitigating the noise effects

and works best with gaussian and uniform noise .

The geometric mean filter works best with gaussian noise and retains detail information

better than an arithmetic mean filter (example of geometric mean filter applied to image with

gaussian noise. It is defined as the product of the pixel values within the window, raised to

the 1/N2 power.

Page 63: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 63

Geometric mean =

Order filters

Order filters operate on small subimages, windows, and replace the center pixel value

(similar to the convolution process). Order statistic is a technique that ranges all the pixels in

sequential order, based on gray-level value.

The most useful of the order filters is the median filter. The median filter selects the

middle pixel value from the ordered set. This type of filter works best with salt-and-pepper

noise. Median filter tends to partially blur image (example of median filter applied to image

with salt & pepper noise is in Fig. 3-1). These disadvantages eliminate adaptive median filter

(example of adaptive median filter applied to image with salt & pepper noise is in Fig. 3-2).

The maximum and minimum filters are two order filters that can be used for elimination

of salt-and-pepper (impulse) noise. The maximum filter selects the largest value within an

ordered window of pixel values whereas the minimum filter selects the smallest value .

7. Explain the Weiner filtering method of restoring images. ( 06 Marks), Dec 2011

Solution: The Wiener filtering is optimal in terms of the mean square error. In other words,

it minimizes the overall mean square error in the process of inverse filtering and noise

smoothing. The Wiener filtering is a linear estimation of the original image. The approach is

based on a stochastic framework. The orthogonality principle implies that the Wiener filter

in Fourier domain can be expressed as follows:

In the absence of any blur, 1),( vuH and

1)(

)(

),(),(

),(),(

SNR

SNR

vuSvuS

vuSvuW

nnff

ff

(i) 1),(1)( vuWSNR

(ii) )(),(1)( SNRvuWSNR

)(SNR is high in low spatial frequencies and low in high spatial frequencies so ),( vuW can

be implemented with a lowpass (smoothing) filter.

Page 64: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 64

8. Justify the statements “ median filter is an effective tool to minimize salt and pepper

noise” using the following image statement below: ( 10

Marks), June 2012

Solution:

Page 65: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 65

Unit-8

1. Explain the following order statistics filters, indicating their uses.

(06 Marks), Dec 2011

i) Median filter ii) max filter iii) min filter.

Solution: Order filters operate on small subimages, windows, and replace the center pixel

value (similar to the convolution process). Order statistic is a technique that ranges all the

pixels in sequential order, based on gray-level value.

The most useful of the order filters is the median filter. The median filter selects the

middle pixel value from the ordered set. This type of filter works best with salt-and-pepper

noise. Median filter tends to partially blur image (example of median filter applied to image

with salt & pepper noise is in Fig. 3-1). These disadvantages eliminate adaptive median filter

(example of adaptive median filter applied to image with salt & pepper noise is in Fig. 3-2).

The maximum and minimum filters are two order filters that can be used for elimination

of salt-and-pepper (impulse) noise. The maximum filter selects the largest value within an

ordered window of pixel values whereas the minimum filter selects the smallest value .

2. Write a note on the following pseudo image processing techniques.

( 08 Marks), Dec 2011

i) Intensity slicing

ii) Graylevel to colour transformations.

Solution:

Page 66: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 66

3. Write steps involved in converting colours from RGB to HSI and vice versa.

(06 Marks), Jan 2010, July 2011

Solution:

Given the intensities of the three primaries RGB of a color, we can find its HSV

representation using different models. Here we use the RGB plane of the cube to find the

corresponding HSV. The three vertices are represented by , and , and the three

components of the given color is represented by a 3D point . We also

assume the intensities are normalized so that the , and values are between 0 and 1,

so that point is inside or on the surface of the color cube.

Determine the intensity I:

One of the definitions of intensity is

Page 67: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 67

Determine the hue H:

First find the intersection of the color vector with the RGB

triangle :

This point is on the RGB triangle as . Here we assume

the point is inside the triangle formed by points , , and . The hue is the

angle formed by the vectors and . Consider the dot product of these two

vectors:

where , and , and

Page 68: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 68

Now the hue angle can be found to be

If , then .

Determine S:

Page 69: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 69

The saturation of the colors on any of the three edges of the RGB triangle is defined as 1

(100% saturated), and the saturation of is zero. Denote as the

intersection of the extension of line with the edge. If the normalized color is

, , and if , . The saturation of any color point between

and is defined as

Here it is assumed that point is inside the triangle so

that .

In general

Conversion from HSI to RGB

Consider three possible cases in terms of the hue angle :

(p inside )

From ,

we get

Page 70: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 70

Also we can get

and

Given , we can get from . As

we have

(p inside )

(p inside )

Page 71: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 71

4. Discuss briefly the HSI color model and RGB color model used in color image

processing. (10 Marks), June 2012, Dec 2011

Solution: RGB

The RGB colour model relates very closely to the way we perceive colour with the r, g and b

receptors in our retinas. RGB uses additive colour mixing and is the basic colour model used

in television or any other medium that projects colour with light. It is the basic colour model

used in computers and for web graphics, but it cannot be used for print production.

The secondary colours of RGB – cyan, magenta, and yellow – are formed by mixing two of

the primary colours (red, green or blue) and excluding the third colour. Red and green

combine to make yellow, green and blue to make cyan, and blue and red form magenta. The

combination of red, green, and blue in full intensity makes white.

In Photoshop using the ―screen‖ mode for the different layers in an image will make the

intensities mix together according to the additive colour mixing model. This is analogous to

stacking slide images on top of each other and shining light through them.

Page 72: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 72

CMYK The 4-colour CMYK model used in printing lays down overlapping layers of

varying percentages of transparent cyan (C), magenta (M) and yellow (Y) inks. In addition a

layer of black (K) ink can be added. The CMYK model uses the subtractive colour model.

Gamut The range, or gamut, of human colour perception is quite large. The two colour

spaces discussed here span only a fraction of the colours we can see. Furthermore the two

spaces do not have the same gamut, meaning that converting from one colour space to the

other may cause problems for colours in the outer regions of the gamuts.

The HSI color space

The HSI color space is very important and attractive color model for image processing

applications because it represents color s similarly how the human eye senses colors.

The HSI color model represents every color with three components: hue ( H ), saturation ( S

), intensity ( I ). The below figure illustrates how the HIS color space represents colors.

Page 73: Ece Vii Image Processing [06ec756] Solution

Image Processing 06EC756

SJBIT/ECE Page 73

The Hue component describes the color itself in the form of an angle between [0,360]

degrees. 0 degree mean red, 120 means green 240 means blue. 60 degrees is yellow, 300

degrees is magenta.

The Saturation component signals how much the color is polluted with white color. The

range of the S component is [0,1].

The Intensity range is between [0,1] and 0 means black, 1 means white.

As the above figure shows, hue is more meaningful when saturation approaches 1 and less

meaningful when saturation approaches 0 or when intensity approaches 0 or 1. Intensity also

limits the saturation values.

To formula that converts from RGB to HSI or back is more complicated than with other

color models, therefore we will not elaborate on the detailed specifics involved in this

process.