Enhancement Using Local Histogram Used to enhance details over small portions o the image. Deine a square or rectangular neighborhood hose center moves rom piel to piel. Compute local histogram based on the chosen neighborhood or each point and appl a histogram equaliation or histogram speciication transormation to the center piel. Non-overlapping neighborhoods can also be used to reduce computations. But this usuall results in some artiacts (checkerboard like patter. Read eample in Section.. o tet. Another use o histogram inormation in image enhancement is the statistical moments associated ith the histogram (recall that the histogram can be thought o as a probabilit densit unctio. For eample e can use the local mean and variance to determine the local brightness/contrast o a piel. This inormation can then be used to determine hat i an transormation to appl to that piel. Note that local histogram based operations are non-uniorm in the sense that a dierent transormation is applied to each piel. Read eample in Section..4 o tet.
Image Enhancement: Spatial Filtering Image enhancement in the spatial domain can be represented as: g ( m T( )( m Transormation Enhanced Image Given Image The transormation T mabe linear or nonlinear. We ill mainl stud linear operators T but ill see one important nonlinear operation. Ho to speci T I the operator T is linear and shit invariant (LSI) characteried b the point-spread sequence (PSS) h ( m then (recall convolutio g( m h( m * l l k k ( m h( m k n l) ( k l) ( m k n l) h( k l)
In practice to reduce computations h ( m is o inite etent: h( k l) or ( k l) here is a small set (called neighborhood). is also called as the support o h. In the requenc domain this can be represented as: G( u v) H ( u v) F ( u v) e here H e ( u v) and F e ( u v) are obtained ater appropriate eropadding. Man LSI operations can be interpreted in the requenc domain as a iltering operation. It has the eect o iltering requenc components (passing certain requenc components and stopping others). The term iltering is generall associated ith such operations. e
Eamples o some common ilters (-D case): Lopass ilter Highpass ilter H(u) H(u) h() h() I h(m is a b mask given b then g( m 4 7 h 4 7 ( m n ) ( m n ) ( m n ) 5 8 5 6 9 ( m ( m 8 6 ( m n ) ( m ( m n ) 9 ( m n )
The output g(m is computed b sliding the mask over each piel o the image (m. This iltering procedure is sometimes reerred to as moving average ilter. Special care is required or the piels at the border o image (m. This depends on the so-called boundar condition. Common choices are: The mask is truncated at the border (ree boundar) The image is etended b appending etra ros/columns at the boundaries. The etension is done b repeating the irst/last ro/column or b setting them to some constant (ied boundar). The boundaries rap around (periodic boundar). In an case the inal output g(m is restricted to the support o the original image (m. The mask operation can be implemented in matlab using the ilter command hich is based on the conv command.
Smoothing Filters Image smoothing reers to an image-to-image transormation designed to smooth or latten the image b reducing the rapid piel-to-piel variation in gravalues. Smoothing ilters are used or: Blurring: This is usuall a preprocessing step or removing small (unanted) details beore etracting the relevant (large) object bridging gaps in lines/curves Noise reduction: Mitigate the eect o noise b linear or nonlinear operations. Image smoothing b averaging (lopass spatial iltering) Smoothing is accomplished b appling an averaging mask. An averaging mask is a mask ith positive eights hich sum to. It computes a eighted average o the piel values in a neighborhood. This operation is sometimes called neighborhood averaging. Some averaging masks: 5 9 6 8 4
This operation is equivalent to lopass iltering. Eample o Image Blurring N N N Original Image Avg. Mask N N 5 N 7 N N 5 N
Eample o noise reduction 5 Zero-mean Gaussian noise Variance. Zero-mean Gaussian noise Variance.5 Noise-ree Image
Median Filtering The averaging ilter is best suited or noise hose distribution is Gaussian: pnoise ( ) ep σ π σ The averaging ilter tpicall blurs edges and sharp details. The median ilter usuall does a better job o preserving edges. Median ilter is particularl suited i the noise pattern ehibits strong (positive and negative) spikes. Eample: salt and pepper noise. Median ilter is a nonlinear ilter that also uses a mask. Each piel is replaced b the median o the piel values in a neighborhood o the given piel. Suppose A { a a ak} are the piel values in a neighborhood o a given piel ith a a ak. Then median( A) a a K / ( K or even )/ or K odd Note: Median o a set o values is the center value ater sorting. For eample: I A {4665 } then median(a) 6. K
Eample o noise reduction Gaussian noise: σ. Salt & Pepper noise: prob.. Nois Image MSE.7 MSE.6 Output o Averaging ilter MSE.75 MSE.5 Output o Median ilter MSE.89 MSE.4
Image Sharpening This involves highlighting ine details or enhancing details that have been blurred. Basic highpass spatial iltering This can be accomplished b a linear shit-invariant operator implemented b means o a mask ith positive and negative coeicients. This is called a sharpening mask since it tends to enhance abrupt gralevel changes in the image. The mask should have a positive coeicient at the center and negative coeicients at the peripher. The coeicients should sum to ero. Eample: 9 8 This is equivalent to highpass iltering. A highpass iltered image g can be thought o as the dierence beteen the original image and a lopass iltered version o :
g( m ( m lopass( ( m ) Eample
High-boost iltering This is a ilter hose output g is produced b subtracting a lopass (blurred) version o rom an ampliied version o g( m A ( m lopass( ( m ) This is also reerred to as unsharp masking. Observe that g( m A ( m lopass( ( m ) ( A ) ( m ( m lopass( ( A ) ( m highpass( ( m ) ( m ) For A > part o the original image is added back to the highpass iltered version o. The result is the original image ith the edges enhanced relative to the original image. Eample: Original Image Highpass iltering High-boost iltering
Derivative ilter Averaging tends to blur details in an image. Averaging involves summation or integration. Naturall dierentiation or dierencing ould tend to enhance abrupt changes i.e. sharpen edges. Most common dierentiation operator is the gradient. The magnitude o the gradient is: Discrete approimations to the magnitude o the gradient is normall used. Consider the olloing image region: ) ( ) ( ) ( / ) ( ) ( ) ( 9 8 7 6 5 4
We ma use the approimation [( ) ( ) ] / ( ) 5 8 5 6 This can implemented using the masks: h and h As ollos: [ ] [( * h ) ( ) ] / ( ) h * Alternativel e ma use the approimation: [( ) ( ) ] / ( ) 5 9 6 8 This can implemented using the masks: h and h As ollos: [( * h ) ( ) ] / ( ) h * The resulting maks are called Roberts cross-gradient operators.
The Roberts operators and the Preitt/Sobel operators (described later) are used or edge detection and are sometimes called edge detectors. Eample: Roberts cross-gradient operator h and h [ ] h and h
Better approimations to the gradient can be obtained b: This can be implemented using the masks: as ollos: The resulting masks are called Preitt operators. Another approimation is given b the masks: The resulting masks are called Sobel operators. ( ) ( ) ( ) ( ) ( ) ( ) [ ] / 7 4 9 6 9 8 7 ) ( and h h ( ) ( ) [ ] / * * ) ( h h and h h Preitt Sobel