image enhancement

Post on 15-Jan-2015

1.866 Views

Category:

Engineering

7 Downloads

Preview:

Click to see full reader

DESCRIPTION

 

TRANSCRIPT

IMAGE ENHANCEMENT

Presented By,

S.RAKOTH KANDAN.

Why we need image enhancement?Why we need image enhancement?

Un-necessary noises

Defects caused by image acquisition

Uneven illumination: non-uniform

Lens: blurring object or background

Motion : blurring

Distortion: geometric distortion caused by lens

Registration

IMAGE ENHANCEMENTPurpose

To improve quality of image

Alters the visual impact of the image 

Use in :Feature Extraction

Image analysis

Visual information display

Two Domains in EnhancementSpatial Domain-- operate directly on pixels.

[ g(x, y) = T[f(x, y)],

where g is the output, f is the input image and T is an operation on f defined over some neighborhood of (x, y).

Frequency Domain -- operate on the Fourier transform of an image.

Gray Level Transformations

Image Negatives

Log Transformation

Power Law Transformation

Piecewise – Linear Transformation Functions

Smoothening & Sharpening

Intensity Domain TechniquesHistogram Equalization & Histogram Matching

Local Enhancement

Use of Histogram Statistics for Image Enhancement

Arithmetic Logic OperationsImage Subtraction & Image Averaging

Enhancement in Frequency Domain

Frequency Domain Filtering

Smoothening

Sharpening

Sources of image

deterioration

Image

Enhanceme

nt System

Machine vision system

Human observer

Noise

Low Resolution

Quantization Levels

Point Processing Operation:Point Processing Operation:

The simplest spatial domain operations occur when the neighborhood is simply the pixel itself. In this case T is referred to as a grey level transformation function or a point processing operation.

Negative of Image:

The most basic and simple operation in digital image processing is to compute the negative of an image. The pixel gray values are inverted to compute the negative of an image.

Thersholding Transformations:Thersholding Transformations:Thresholding transformation are particularly useful for segmentation in which we want to isolate an object of interest from a background.Logarithmic Transformations:The general form of the log transformation is

s = c * log (1 + r)The log transformation maps a narrow range of low input grey level values into a wider range of output values. The inverse log transformation performs the opposite transformation. Log functions are particularly useful when the input grey level values may have an extremely large range of values.

Powers-Law Powers-Law TransformationsTransformations

The nth power and nth root curves can be given by the expression

s = crγ

This transformation function is also called as gamma correction. For various values of (γ) different levels of enhancements can be obtained. This technique is quite commonly called as Gamma Correction.

Piecewise Linear Transformation Piecewise Linear Transformation FunctionsFunctions

Rather than using a well defined mathematical function we can use arbitrary user-defined transforms.

Advantage: The form of piecewise functions can be arbitrary complex over the previous functions.

Disadvantage: Require considerably more user input.

Grey Level SlicingGrey Level Slicing

Grey level slicing is the spatial domain equivalent to band-pass filtering. A grey level slicing function can either emphasize a group of intensities and diminish all others or it can emphasize a group of grey levels and leave the rest alone.

Histogram ProcessingHistogram Processing

The histogram of a digital image with intensity levels in the range [0, L-1] is a discrete function Histograms are frequently normalized by the total number of pixels in the image. Assuming an M x N image, a normalized. Histogram is related to probability of occurrence of in the image

Histogram EqualizationHistogram Equalization

Histogram equalization is a common technique for enhancing the appearance of images. Suppose we have an image which is predominantly dark.

Then its histogram would be skewed towards the lower end of the grey scale and all the image detail is compressed into the dark end of the histogram.

If we could ‘stretch out' the grey levels at the dark end to produce a more uniformly distributed histogram then the image would become much clearer.

Histogram specificationHistogram specification

Histogram equalization only generates an approximation to a uniform histogram. Sometimes the ability to specify particular histogram shapes capable of highlighting certain gray-level ranges in an image is desirable.

Procedures:

1. Determine the transformation sk= T(rk) that can equalize the original image's histogram pr(r).

2. Determine the transformation sk = G(bk) that can equalize the desired image's histogram pb(b).

3. Perform transformation G-1 (T(rk) ).

The principal difficulty in applying the histogram specification method to image enhancement lies in being able to construct a meaningful histogram.

Local EnhancementLocal Enhancement

Previous methods of histogram equalizations and histogram matching are global. So, local enhancement is used. Define square or rectangular neighborhood (mask) and move the center from pixel to pixel. For each neighborhood, calculate histogram of the points in the neighborhood. Obtain histogram equalization/specification function. Map gray level of pixel centered in neighborhood. It can use new pixel values and previous histogram to calculate next histogram.

a) Original Image (b) Result of global histogram Equalization (c) Result of Local histogram equalization using 7x7 neighborhood about each pixel

Spatial Filtering:Spatial Filtering:

The use of spatial masks for image processing is called spatial filtering.

The masks used are called spatial filters.

The basic approach is to sum products between the mask coefficients and the intensities of the pixels under the mask at a specific location in the image.

If the center of the mask is at location (x,y) in the image, the gray level of the pixel located at (x,y) is replaced by R, the mask is then moved to the next location in the image and the process is repeated. This continues until all pixel locations have been covered.

Smoothing filter:Smoothing filter:

Smoothing filters are used for blurring and for noise reduction.

Blurring is used in preprocessing steps, such as removal of small details from an image prior to object extraction, and bridging of small gaps in lines or curves.

Noise reduction can be accomplishing by blurring with a linear filter and also by nonlinear filtering.

Low pass filtering:Low pass filtering:

The key requirement is that all coefficients are positive.

Neighborhood averaging is a special case of LPF where all coefficients are equal.

It blurs edges and other sharp details in the image.

Gaussian

High-Pass Filters:High-Pass Filters:

Highlight fine detail or enhance detail that has been blurred.

The elements of the mask contain both positive and negative weights.

Sum of the mask weights is 0 (after normalization)

1st derivativeof Gaussian

2nd derivativeof Gaussian

Median filtering:Median filtering:

If the objective is to achieve noise reduction instead of blurring, this method should be used.

This method is particularly effective when the noise pattern consists of strong, spike-like components and the characteristic to be preserved is edge sharpness.

It is a nonlinear operation.

For each input pixel f(x,y), we sort the values of the pixel and its neighbors to determine their median and assign its value to output pixel g(x,y).

Sharpening Filters:Sharpening Filters:

The shape of the impulse response needed to implement a highpass spatial filter indicates that the filter should have positive coefficients near its center, and negative coefficients in the outer periphery.

The filtering output pixels might be of a gray level exceeding [0,L-1].

Derivative Filters:Derivative Filters:

Taking the derivative of an image results in sharpening the image.

The derivative of an image can be computed using the gradient.

Noise:Noise:

Reducing Noise

Where does noise come from?

• Scanner resolution

• Film grain (granularity)

• Hardware (interference patterns)

Common types of noise:

• White noise (Gaussian)

• Local variance (Gaussian with intensity-dependent variance)

• Salt and pepper

• Speckle

Filter:

A filter can be used to reduce the effect of noise in an image. The Image Processing Toolbox provides three main methods of filtering:

• Linear filtering

• Median filtering

• Adaptive filtering

Different methods are better for different kinds of noise.

In the following section we will investigate the types of methods, and what type of noise they are most effective in reducing.

How Do I Model Noise?

The function imnoise allows different types of noise to be modeled.

Syntax:

J = imnoise(I,type,parameters)

I = Image

type – gaussian, localvar, poisson, salt & pepper, speckle

parameters – additional parameters needed given the type of noise

Linear Filtering

A linear filter computes each output pixel value according to a linear combination of the input pixel's neighborhood.

The basics of linear filtering are done through correlation and convolution.

In the Image Processing Toolbox both these operations are performed using the imfilter command

Linear Filtering:

i = imread('rose.jpg');

j=rgb2gray(i);

h = ones(5,5) / 25;

i2 = imfilter(j,h);

i3=imfilter(j,h,'replicate');

figure,imshow(i), title('Original Image');

figure,imshow(j),title('Gray Image');

figure, imshow(i2), title('Filtered Image');

figure,imshow(i3)

Filtering using imfilter

Syntax

B = imfilter(A,H)

B = imfilter(A,H,option1,option2,...)

A – Input image

H – The filter, also known as the correlation or convolution kernel.

options – Boundary options, output size option,

correlation and convolution option

Note: By default imfilter performs correlation.

Special Linear Filters

The function fspecial creates a variety of 2-D filters.

Syntax:

h = fspecial(type, parameter)

h – two-dimensional correlation kernel

type – one of the specified special filter types:

gaussian,sobel,prewitt,laplacian,log,motion,average,circular averaging(disk), and a contrast sharpening (unsharp) filter

parameters – particular to the type of filter chosen

Median Filtering:

When noise causes the pixels to vary greatly from the original value (salt and pepper), a median filter is more effective in reducing the noise.

Syntax:

B = medfilt2(A,[m n])

A – Input image

B – Output image

[m n] – Neighborhood block size to be used to calculate the median.

Adding Noise to image:i=imread(‘rose.jpg’);imshow(i)j=imnoise(I,’salt&pepper’,0.02);figure,imshow(j)

Noise removing using Average filter:i=imread(‘rose.jpg’);imshow(i)j=imnoise(I,’salt&pepper’,0.02);figure,imshow(j)k=filter2(fspecial(‘average’,3),j)/255;figure,imshow(k)

Noise removing using Median Filter :

i=imread(‘rose.jpg’);

imshow(i)

j=imnoise(I,’salt&pepper’,0.02);

figure,imshow(j)

k=medfilt2(j,[3 3]);

figure,imshow(i)

figure,imshow(j)

figure,imshow(k)

Adaptive Filter

The wiener2 adaptive filter tailors itself to the local image variance adaptively. If the variance is large, it minimally smoothes the image. If the variance is small, it performs more smoothing. This type of filter is effective in reducing the effects of Gaussian white noise.

Syntax: [J,noise] = wiener2(I,[m n],noise)

I – Input image

[m n] – Size neighborhood block used to calculate the median.

J – Output image, noise – Noise variance

Noise removing by Adaptive Filter:

RGB=imread(‘rose.jpg’);

i=rgb2gray(RGB);

j=imnoise(I,’gaussian’,0,0.025);

imshow(j)

k=wiener2(j,[5 5]);

figure, imshow(k)

Image Negative:

i=imread(‘rose.jpg');

figure,imshow(i);

IM2=imcomplement(i);

figure,imshow(IM2)

Histogram:

A histogram of an image shows the current level of contrast (the distribution of gray levels).

Histogram Equalization:

The histeq function can be used to equally distribute the histogram and enhance the contrast.

i=imread('rose.jpg');

j=rgb2gray(i);

k=histeq(j);

imshow(i)

figure,imshow(j)

figure;imhist(k)

Histogram Adjustment:

Intensity adjustment is a technique for mapping an image's intensity values to a new range (imadjust).

i = imread(‘rose.jpg');

j=rgb2gray(i);

k= imadjust(j,[0 0.2],[0.5 1]);

imshow(i)

figure, imshow(j)

figure,imshow(k)

Image Arithmetic:

With just simple addition, subtraction, multiplication and division a number of different image processing techniques can be implemented.

With addition and multiplication an image contrast can be increased that facilitates edge detection process.

With subtraction and division changes can be detected from one image to another.

imabsdiff - Compute absolute difference of two images

imadd - Add two images or add constant to image

imcomplement - Complement image

imdivide - Divide two images or divide image by a constant

imlincomb - Compute linear combination of images

immultiply - Multiply two images.

imsubtract - Subtract two images.

Create a adaptive histogram equalization:

i=imread('Rose.jpg');

j=rgb2gray(i);

k=adapthisteq(j,'clipLimit',1,'Distribution','rayleigh','Range','full','NBins',123);

figure,imshow(i);

figure,imshow(j);

figure,imshow(k);

top related