You are on page 1of 73

Image Processing

06EC756

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.

SJBIT/ECE

Page 1

Image Processing

06EC756
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.

SJBIT/ECE

Page 2

Image Processing

06EC756

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

SJBIT/ECE

Page 3

Image Processing

06EC756

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
SJBIT/ECE Page 4

Image Processing

06EC756

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, heatsensitive 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.

SJBIT/ECE

Page 5

Image Processing

06EC756

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.

SJBIT/ECE

Page 6

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

06EC756

( 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 .

SJBIT/ECE

Page 7

Image Processing

06EC756

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 8

SJBIT/ECE

Image Processing

06EC756

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.

SJBIT/ECE

Page 9

Image Processing

06EC756

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 graylevel assignment of each pixel is predetermined by the fact that new locations are exact duplicates of old locations.

SJBIT/ECE

Page 10

Image Processing

06EC756

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 madjacent if (i) q is in N4(p), or (ii) q is in ND(p) and the set has no pixels whose values Mixed adjacency is a modification of 8-adjacency. are from V.

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. OneSJBIT/ECE Page 11

Image Processing

06EC756

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) 2011 Repeat for V={1,2} 3 2 1 (p) 1 1 2 2 0 2 0 1 1 1 2 1 2 (q) ( 06 Marks), July 2011, Dec

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.

SJBIT/ECE

Page 12

Image Processing

06EC756

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 5 4 0 2 0 3 2 0 2 4 2 1 1 3 5 ( p) 1 3 5 1 3 (q)

Solution:

SJBIT/ECE

Page 13

Image Processing

06EC756

9.

Explain some of the widely used gray-level transformation. Solution: Gray level mapping

( 10 Marks), Dec 2010

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 histogram is to ( for a 8-bit image. The ith item of the ) 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 connected by straight lines, such as shown here:
SJBIT/ECE

break points , with neighboring points


Page 14

Image Processing

06EC756

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.

SJBIT/ECE

Page 15

Image Processing

06EC756

Negative image:

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

SJBIT/ECE

Page 16

Image Processing
Example:

06EC756

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.

SJBIT/ECE

Page 17

Image Processing

06EC756

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 percentage (e.g., , is very close to 1). In this case we can push a small ) of gray levels close to the two ends of the histogram toward

SJBIT/ECE

Page 18

Image Processing
Or

06EC756

Linear function Negative and identity transformations Logarithm function Log and inverse-log transformations Power-law function nth power and nth root transformations

SJBIT/ECE

Page 19

Image Processing

06EC756

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 M
N array, such as that obtained by sampling a continuous function of

two dimensions at dimensions M and N on a rectangular grid, then its two dimensional Discrete Fourier transform (DFT) is the array given by
F (u, v) 1 MN
M 1N 1

f ( x, y)e
x 0 y 0

j 2 ( ux / M vy / N )

, where u 0, , M 1 , v 0,, N 1

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:
SJBIT/ECE Page 20

Image Processing

06EC756

, the separable product of a 1-D N1 -point and N2 -point DFT. Circular shifting:

where the shift vector valued.

is integer

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 the circular shift of x,

, it follows that the periodic shift of

agrees with

for of the right-hand side, over

, so the DFS of the left-hand side must equal the DFT the fundamental period in frequency, i.e.,

. We have thus have the DFT

SJBIT/ECE

Page 21

Image Processing

06EC756

Figure( 4.4): Example of 2D Circular Convolution

SJBIT/ECE

Page 22

Image Processing

06EC756

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. 5.
N 1N 1

g (u , v)

T (u , v, x, y ) f ( x, y )
x 0 y 0

N 1N 1

f ( x, y )
u 0v 0

I ( x, y, u, v) g (u, v)
I ( x, y, u, v) are called the forward and inverse

where, again, T (u, v, x, y ) and

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 23

SJBIT/ECE

Image Processing

06EC756

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 subhistogram 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
SJBIT/ECE Page 24

Image Processing

06EC756

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.

SJBIT/ECE

Page 25

Image Processing

06EC756

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 by the following iteration rule: matrix , generated

(4.5.1)

Where And denotes the Kronecker product of two matrices .

(4.5.2)

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

SJBIT/ECE

Page 26

Image Processing

06EC756

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 2. subtractions and/or additions are also available.

Compute the Discrete Cosine Transform (DCT) matrix for N= 4 ( 10 Marks), Dec 2010. June 2012 Solution:

SJBIT/ECE

Page 27

Image Processing

06EC756

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 following iteration rule:

matrix

, generated by the

(4.5.1) where

(4.5.2)

And

denotes the Kronecker product of two matrices .

SJBIT/ECE

Page 28

Image Processing

06EC756

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.

SJBIT/ECE

Page 29

Image Processing

06EC756

3. Define Hadamard transform and Harr transform for N=4 Solution:

(12 Marks), Jan 2010

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 respectively. The are the signal and spectrum vectors, th element of the transform can also be written as

The complexity of WHT is WHT and signal algorithm

. Similar to FFT algorithm, we can derive a fast of . We will assume point of

with complexity

in the following derivation. An is defined as

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

vector

SJBIT/ECE

Page 30

Image Processing

06EC756

(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


SJBIT/ECE Page 31

Image Processing

06EC756

(8)

where

(9)

through a n d

of the second half can be obtained similarly.

(10)

Summarizing the above steps of Equations (2), (4), (6), (8), (9) and (10), we get the Fast WHT algorithm as illustrated below.

SJBIT/ECE

Page 32

Image Processing

06EC756

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 transform. For example, when by ,

matrix for discrete Haar , 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:

SJBIT/ECE

Page 33

Image Processing

06EC756

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 row vector of the transform matrix. The inverse transform is

onto the n-th

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.
SJBIT/ECE Page 34

Image Processing Unit-5

06EC756

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

s T (r)

L 1 r 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.

s T (r )

L 1

L 1
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 N
N with grey levels in the range [0, L 1] . The

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


p ( rk ) nk N2

Where rk is the kth grey level, k

0,1,, L 1

SJBIT/ECE

Page 35

Image Processing
nk is the number of pixels in the image with grey level rk N 2 is the total number of pixels in the image

06EC756

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 [0, L 1] . Suppose we divide the image intensity with its maximum value L 1 . Let the variable r represent the new grey levels (image intensity) in the image, where now 0 r 1 and let pr (r ) denote the probability density function (pdf) of the variable r . We now apply the following transformation function to the intensity
r

s T (r)
0

pr ( w)dw ,

r 1

(1) By observing the transformation of equation (1) we immediately see that it possesses the following properties: (i) 0 s 1 . (ii) r2 (iii) image

r1

T (r2 ) T (r1 ) , i.e., the function T (r ) is increase ng with r .


0 1

s T (0)
0

pr ( w)dw 0 and s T (1)


0

p r ( w)dw 1 . Moreover, if the original

has
rmin

intensities
pr ( w)dw 0
0

only

within and

certain
s T (rmax )

range
rmax

[rmin , rmax ]

then since

s T (rmin )

pr ( w)dw 1
0

pr (r ) 0, r rmin and r
the available range [0 1].

rmax . Therefore, the new intensity takes always all values within

Suppose that Pr (r ) , Ps ( s) are the probability distribution functions (PDFs) of the variables

r and s respectively.

SJBIT/ECE

Page 36

Image Processing
Let us assume that the original intensity lies within the values r and r

06EC756
dr with dr a small

quantity. dr can be assumed small enough so as to be able to consider the function pr (w) constant within the interval [r , r dr ] and equal to pr (r ) . Therefore,
r dr r dr

Pr [r , r dr ]
r

pr ( w)dw

pr (r )
r

dw

pr (r )dr .

Now suppose that s T (r ) and s1 T (r dr) . The quantity dr can be assumed small enough so as to be able to consider that s1

s ds with ds small enough so as to be able to

consider the function ps (w) constant within the interval [ s, s ds] and equal to ps (s) . Therefore,
s ds s ds

Ps [ s, s ds]
s

ps ( w)dw

ps ( s) dw
s

ps ( s)ds

Since s T (r ) , s ds T (r dr ) and the function of equation (1) is increasing with r , all and only the values within the interval [r , r dr ] will be mapped within the interval
[ s, s ds] . Therefore,
r T
1

(s)

Pr [r, r dr] Ps [s, s ds]

pr (r )dr

ps ( s )ds

ps ( s )

pr ( r )

dr ds r

(s)

From equation (1) we see that

ds dr
and hence,
1 pr ( r )

pr ( r )

ps ( s )

pr ( r )

1, 0 s 1
r T
1

(s)

SJBIT/ECE

Page 37

Image Processing

06EC756

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 to the desired image can be

image and the overall transform from the given image found as:

where both and can be found from the histogram of the given image desired histogram, respectively.

and the

SJBIT/ECE

Page 38

Image Processing

06EC756

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 matches :

, find

and then find a

level so that

best

. 5. Perform histogram equalization for the following image data, sketch the histogram of the original image and histogram of equalized image. ( 10 Marks) Solution:

SJBIT/ECE

Page 39

Image Processing

06EC756

6. Explain the following image enhancement techniques, highlighting their area of application. i) ii) Intensity level slicing Power law transformation ( 10 Marks), Dec 2011, July 2011

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 40

SJBIT/ECE

Image Processing

06EC756

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 where C and r are +ve constants As in log transformation, power- law curves with (1)

Figure(5.16)

SJBIT/ECE

Page 41

Image Processing
For

06EC756
> maps a narrow range of dark i/p values into a wider range of o/p values and we obtain a family of

with the opposite being true for higher values of i/p. By varying 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.

SJBIT/ECE

Page 42

Image Processing

06EC756

Figure(5.17)

7. Explain the following image enhancement techniques, highlighting their area of application. i) ii) Bit plane slicing. AND and OR operation (10 Marks), July 2011

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)

SJBIT/ECE

Page 43

Image Processing

06EC756

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 0s) produces a white pixel (a string of eight 1s). Intermediate values are processed the same way, changing all 1s to 0s 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.

SJBIT/ECE

Page 44

Image Processing

06EC756

(a)

Fig. 3.27

(b)

(c)

(d) Fig. 3.27

(e)

(f)

SJBIT/ECE

Page 45

Image Processing Unit-6


1. Explain the smoothing of images in frequency domain using: i) ii) Ideal low pass filter Butterworth lowpass filter

06EC756

( 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 and N 2q-1. (4.6-32) (4.6-31)

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)
SJBIT/ECE Page 46

Image Processing

06EC756

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:

SJBIT/ECE

Page 47

Image Processing

06EC756

SJBIT/ECE

Page 48

Image Processing

06EC756

and

3. Explain the basic concept of spatial filtering in image enhancement and hence explain the importance of smoothing filters and median filters. Solution: A 3 3 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

(10 Marks) Jan 2010

To be able to estimate the effects of the above mask with relation to the sign of the coefficients a, b, c, d , e, f , g , h , we will consider the equivalent one dimensional mask

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

y ( n) as y (n) dx(n 1) x(n) ex(n 1)

Y ( z)

dz 1 X ( z )

X ( z ) ezX ( z )

Y ( z)

( dz

1 ez ) X ( z )

Y ( z) X ( z)

H ( z ) dz

1 ez .

SJBIT/ECE

Page 49

Image Processing

06EC756

This is the transfer function of a system that produces the above input-output relationship. In the frequency domain we have
H (e j ) d exp( j ) 1 e exp( j ) .

The values of this transfer function at frequencies


H (e j ) d 1 e

0 and

are:

H (e j )

1 e

If a lowpass filtering (smoothing) effect is required then the following condition must hold
H (e j ) H (e j ) d e 0

Gaussian filtering The two dimensional Gaussian mask has values that attempts to approximate the continuous function
1 2
2
x2 y 2 2

G ( x, y )

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.

1 1 273 4

4 16 26 16

7 26 41 26

4 16 26 16

1 4 7 4

7 Median filtering 4

4 that 7 possesses 4 1 the property that half the values The median m of a set of values is1the value 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.
Page 50

SJBIT/ECE

Image Processing
Median filters are non linear filters because for two sequences x(n) and y ( n )

06EC756

median x(n) y(n)

median x(n)

median y(n)

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 Isolated 0 0 0 0 1 0 0 0 0 Median filtering point 0 0 0 0 0 0 0 0 0

4. Write short notes on Weiner filtering and inverse filtering Solution: Inverse filtering The objective is to minimize
J (f ) n( f )
2

( 10 Marks), June 2012

y Hf

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

J (f ) f
f

2H T ( y Hf ) 0

( H T H) -1 H T y

If M

N and H

exists then
f H -1 y

According to the previous analysis if H (and therefore H -1 ) is block circulant the above problem can be solved as a set of M
N scalar problems as follows

SJBIT/ECE

Page 51

Image Processing

06EC756

F ( u, v )

H (u, v )Y (u, v ) H ( u, v )
2

f (i , j )

H (u, v )Y (u, v ) H ( u, v )
2

(I) Suppose first that the additive noise n(i, j ) is negligible. A problem arises if H (u, v ) becomes very small or zero for some point (u, v ) or for a whole region in the (u, v ) plane. In that region inverse filtering cannot be applied. Note that in most real applications H (u, v ) 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 F (u, v ) . (II) In the presence of external noise we have that
(u , v) F H (u , v) Y (u , v) H (u , v) H (u , v)Y (u , v) H (u , v)
2 2

N (u , v)

H (u , v) N (u, v) H (u, v)
2

(u , v) F

F (u, v)

N (u , v) H (u , v)

If H (u, v ) becomes very small, the term N (u, v ) dominates the result. The solution is again to carry out the restoration process in a limited neighborhood about the origin where H (u, v ) is not very small. This procedure is called pseudoinverse filtering. In that case we set
H (u , v)Y (u , v) (u , v) F 0 H (u , v)
2

H (u , v) T

H (u , v) T

The threshold T is defined by the user. In general, the noise may very well possess large components at high frequencies (u, v ) , while H (u, v ) and Y (u, v ) normally will be dominated by low frequency components.

SJBIT/ECE

Page 52

Image Processing
Wiener filter

06EC756

SJBIT/ECE

Page 53

Image Processing

06EC756

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:

y(i, j) r w(i, j)

n(i, j)

SJBIT/ECE

Page 54

Image Processing
w(i, j ) H f (i, j ) h(i, j , i , j ) f (i , j )di dj

06EC756

n(i, j)

g r[w(i, j)] n1 (i, j) n2 (i, j)

where y (i, j ) is the degraded image, f (i, j ) is the original image and h(i, j, i , j ) is an operator that represents the degradation process, for example a blurring process. Functions

and r

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

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

g r H[ f (i, j)] n1 (i, j) and an image-independent random com


Noise Model The principal sources of noise in digital images (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 arise during image acquisition

components) The Fourier spectrum of noise is constant (The noise usually is called white noise) component n2 (i, j) .

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

SJBIT/ECE

Page 55

Image Processing

06EC756

SJBIT/ECE

Page 56

Image Processing Applications of Noise Probability Density Functions

06EC756

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 57

SJBIT/ECE

Image Processing

06EC756

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 with a probability of 0.1;

b) Result of arithmetic mean filtering;

c) Result of adaptive median filtering;

d) Result of standard median filtering

SJBIT/ECE

Page 58

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

06EC756

(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 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 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. image corrupted by sinusoidal noise of various component(s) in the frequency domain is

SJBIT/ECE

Page 59

Image Processing Bandpass Filters

06EC756

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 H NP (u, v) = 1 . H NR( ,u v)

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 (5.4-5)
Page 60

SJBIT/ECE

Image Processing

06EC756

4. Derive the expression for observed image when the degradations are linear position invariant. ( 08 Marks) July 2011

Solution: consider the general degradation model

y(i, j) H f (i, j)

n(i, j)

If we ignore the presence of the external noise n(i, j ) we get

y(i, j)
H is linear if

H f (i, j)

H k1 f1 (i, j) k2 f 2 (i, j)
H is position (or space) invariant if

k1H f1 (i, j)

k2 H f 2 (i, j)

H f (i a, j b)

y(i a, j b)

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: Disadvantage: Extensive tools of linear system theory become available. 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. 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 61

( 06 Marks), Dec2010

SJBIT/ECE

Image Processing
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

06EC756

The objective is to nd an estimatef(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.

SJBIT/ECE

Page 62

Image Processing
Geometric mean =

06EC756

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, H (u, v ) 1 and
W ( u, v ) S ff (u, v ) S ff (u, v ) S nn (u, v ) ( SNR) ( SNR) 1

(i) (ii)

( SNR )
( SNR )

1
1

W ( u, v ) 1
W (u, v ) ( SNR )

( SNR ) is high in low spatial frequencies and low in high spatial frequencies so W (u, v ) can

be implemented with a lowpass (smoothing) filter.

SJBIT/ECE

Page 63

Image Processing

06EC756

8. Justify the statements median filter is an effective tool to minimize salt and pepper noise using the following image statement below: Marks), June 2012 ( 10

Solution:

SJBIT/ECE

Page 64

Image Processing

06EC756

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:

SJBIT/ECE

Page 65

Image Processing

06EC756

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 components of the given color is represented by a 3D point assume the intensities are normalized so that the so that point , and , and , and the three . We also values are between 0 and 1,

is inside or on the surface of the color cube.

Determine the intensity I: One of the definitions of intensity is

SJBIT/ECE

Page 66

Image Processing

06EC756

Determine the hue H:

First find the intersection of the color vector triangle :

with the RGB

This point the point

is on the RGB triangle as is inside the triangle formed by points , , and

. Here we assume . The hue is the

angle vectors:

formed by the vectors

and

. Consider the dot product of these two

where

and

, and

SJBIT/ECE

Page 67

Image Processing

06EC756

Now the hue angle can be found to be

If Determine S:

, then

SJBIT/ECE

Page 68

Image Processing

06EC756

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 intersection of the extension of line , and , and if is defined as , is zero. Denote as with the edge. If the normalized color is . The saturation of any color point between the

Here that

it

is

assumed .

that

point

is

inside

the

triangle

so

In general

Conversion from HSI to RGB Consider three possible cases in terms of the hue angle :

(p inside

From

we get
SJBIT/ECE Page 69

Image Processing
Also we can get

06EC756

and

Given

, we can get

from

. As

we have

(p inside

(p inside

SJBIT/ECE

Page 70

Image Processing

06EC756

4. Discuss briefly the HSI color model and RGB color model used in color image processing. 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. (10 Marks), June 2012, Dec 2011

SJBIT/ECE

Page 71

Image Processing

06EC756

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.

SJBIT/ECE

Page 72

Image Processing

06EC756

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.

SJBIT/ECE

Page 73