0% found this document useful (0 votes)
8 views24 pages

Spatial Domain

digital image processing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
8 views24 pages

Spatial Domain

digital image processing
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 24
IMAGE ENHANCEMENT IN SPATIAL DOMAIN CONTENTS + INTRODUCTION * BACKGROUND + BASIC GRAY LEVEL TRANSFORMATIONS + HISTOGRAM PROCESSING * ENHANCEMENT USING ARITHMETIC/LOGIC OPERATIONS + BASICS OF SPATIAL FILTERING + LOCAL ENHANCEMENT INTRODUCTION * PRINCIPAL OBJECTIVE OF ENHANCEMENT : Process an image so that the result is more suitable than the original image for a specific application. + IMAGE ENHANCEMENT APPROACHES FALL INTO TWO BROAD CATEGORIES : 1. Spatial Domain Methods 2. Frequency Domain Methods + Spatial domain refers to the image plane itself and are based on direct manipulation of pixels in an image. * Frequency domain processing techniques are based on modifying the Fourier transform of an image. + Image enhancement techniques are based on gray level transformation functions. BACKGROUND + Spatial domain processes are denoted by the expression (69) = Theo] where, {(x,y) is input image and g(x,y) is processed image, T is an operator on f, defined over some neighborhood of (x,y) + Square or Rectangular subimage area centered at (x,y) is used as neighborhood origin about a point (x,y). + Here, T is a gray level transformation function of the form : s=Ti(r) where, rand s — denote the gray levels of f(x,y) and g(x,y) at any point (x,y). Fig: 3 x 3 neighborhood about a point (x,y) in an image s=T(r) a = = Tr) t i i v x 5 3 r r m m dark€@---- light dark€—-->light Contrast stretching Thresholding function * A pixel value of ‘r’ is mapped into a pixel value ‘s’ based on type of transformation ‘T’ Fig : Gray level transformation functions for contrast enhancement BASIC GRAY LEVEL TRANSFORMATIONS IMAGE NEGATIVES The negative of an image with gray levels in the range[0,L-1] is obtained La using negative transformations as in fig. and the expression is : s=L-l-r This type of processing is particularly suit? for enhancing white or gray detail embedded in dark regions of an image, especially when the black area is dominant in size. w/a La Contd.. Fig1: original image Fig2: image negative Fig1 is the original image and fig2 is the result of the image negative where the dark region of the image gets converted into the light region .i.e. binary 1 becomes binary 0 and vice versa. - LOG TRANSFORMATIONS The general form of the log transformation is shown in fig and the expression is : s=c log (1+) Lt where, ¢ is a constant and assume r>0) The shape of the log curve indicates z that the transformation maps a narrow SUR range of low gray-level values inthe = s input image into a wider range of 3 output levels and vice versa. It is used for spreading/compressing of gray levels in an image. Input gray level, r . POWER-LAW TRANSFORMATION power-law transformation has the basic form: s=cr’ where, c and r are positive constants. The curve generated with the value of y>1 has exactly the opposite effect as those generated with y<1. By convention, the exponent in the power law equation is referred to as gamma. The output gray level, s process used to correct this power law response is called gamma correction. Images that are not corrected properly can 0 look either bleached out or too dark. L/2 1 Input gray level, r 4, PIECEWISE-LINEAR TRANSFORMATION 1.CONTRAST STRETCHING Lew contrast images can result from poor illumination, lack of dynamic range in image sensor or even wrong setting of a lens aperture during image acquisition. + Ifrl=sl & r2=s2, the transformation is LL a linear function that produces no change in gray levels. + Ifrl=r2,s1=0&s2=L-1,the transformation is a thresholding function that creates binary image. * Intermediate values of (r1,s1) & (12,82) produces various degrees of spread in gra levels of output image thus affecting its contrast, L/2 “output gray level, s Lf, La Input gray level, r Fig: transformation used for contrast stretching Contd... Figi: low contrast image Fig2: high contrast image 2. GRAY LEVEL SLICING There are several ways of doing this technique, but most of them are variations of two basic themes: Display high value for all gray levels in the range of interest and low values for all other gray values which produces binary image(fig1). Brightening the desired range of gray levels but preserving the background and gray level tonalities in the image(fig2). Ll bd 3 Tir) z a 2 = = & = FA 3 9 A pe tt 0 AB ua Input gray level, r Input gray level, r . BIT-PLANE SLICING Focus is on highlighting the contributic One 8-bit byte Bit plane 7(MSB) made to total image appearance by specific bits. Higher order bits(top 4) contain the majority of the visually significant data. Other bit planes contribute to | Bit plane 0 (LSB) more subile details in the image. sai : Fig : Bit plane representation of an 8 bit image HISTOGRAM PROCESSING The histogram of a digital image with gray levels in the range[0,L-1] is a discrete function, h(n) =n, where, f, is the kt" gray level & nj, is number of pixels in the image having gray level ry, Histogram is normalized by dividing each of its values by the total no. of pixels in the image denoted by ‘n Thus normalized histogram is given by, Pn) = = =e where, k = 0,1,2,....L-1 Histograms are the basis for the numerous spatial domain processing techniques. Histogram manipulation is used effectively for image enhancement, also quite useful in other image processing applications viz image compression & segmentation. Contd.. HISTOGRAM EQUALIZATION Let us consider the transformation as, S = T(r), 0) BH) & 2k =0,1,2,...L-1 Thus a processed (output) image is obtained by mapping each pixel with level r, in the input image into a corresponding pixel with level S, in the output image via the above equation. + Aplot of P.(r,) Vs 1, is called Aistogram. The transformation (mapping) given in above equation is called histogram equatization or histogram linearization. + Histogram equalization automatically determines a transformation function that seeks to preduce an output image has a uniform histogram. * The method used to generate a processed image that has a specified histogram is called histogram matching or histogram specification, Par, Pt Th Fig1: dark image Fig2: light image Pun) Pr) N Fig3: low contrast image Fig4: high contrast image Histogram plots for various kinds of images Ne Mh ENHANCEMENT USING ARITHMETIC/LOGIC OPERATIONS It involves operations performed on a pixel by pixel basis between two or more images (excluding NOT, which is performed on single image) Any logical operators can be implemented by using only 3 basic functions(4ND, OR & NOT). The AND and OR operations are used for masking; i.e. for selecting subimages in an image. light represents binary] and dark represents binary 0. IMAGE SUBTRACTION The difference between two images f(x,y) and h(x,y) expressed as at, fry) —h(x,y) The key usefulness of subtraction is the enhancement of differences between images. Difference is taken between corresponding pixels of *f and ‘*h’. Fig: image1 Fig2: image1 Fig3: result of subtraction The above figure 1 &2 indicates the image taken for subtraction and the figure? indicates the result of subtraction of image! with itself. IMAGE AVERAGING The purpose of image averaging is noise removal. Consider a noisy image g(x,y) formed by the addition of noise n(x,y) to an original image f(x,y); i.e. BOY) = fo y) + aboy) If the noise satisfies the constraint (uncorrelated at every coordinate (x,y)), then averaged image is given by K gx, y) = m2 Gy) then it follows that, Ef glx.y)} = fy) iLe. it is expected the averaged image approaches to the original image as the number of noisy images used in the averaging process increases BASICS OF SPATIAL FILTERING Fig: mechanics of spatial filtering mask, Mask coefficients w lw Image f(x,y) cm | can Ww elt) Ww (1) W 0.0) WwW Out) w |w [lw et) | C00 | ct) fix+ly) Contd.. * The process consists of moving the filter mask from point to point in an image. + For linear spatial filtering, the response is given by a sum of products of the filter(mask) coefficients and the corresponding pixels directly under the mask as: R=w(-L-D) fOc-Ly-1) + w(-l,0) fbe-L,y)+e..0+ WOO CGY) Fee tereseees +w(L,Ofct Ly) wi, Dict Lyt D. + In general, linear filtering of an image f of size MxN with a filter mask of size mxn is given by the expression, a» > Py w(s,t) fle +s. +2) where, a=(m-1)/2 and b=(n-1)/2 + The process of linear filtering is similar to a frequency domain concept called convolution. for this reason, linear spatial filtering often is referred to as “convolving a mask with an image”. Filter masks are sometimes called “convolution masks” or “convolution kernel”. o(x.y) LOCAL ENHANCEMENT The histogram processing method are global, i.e. the pixels are modified by a transformation function based on the gray level content of an entire image. When there is a case to enhance details over small areas in an image, there will be a problem. The solution is to devise a transformation functions based on the gray level distribution or other properties in the neighborhood of every pixel in the image. The procedure is to define a square or rectangular neighborhood & move the center of this area from pixel to pixel. At each location, the histogram of the point in the neighborhood is computed & either a histogram equatization or histogram specification transformation function is obtained. This function is finally used to map the gray level of the pixel centered in the neighborhood. Thank Yo"

You might also like