Swordrock's Blog

Just another WordPress.com site

Image processing 3


Hi !

Today i will talk about ;

Intensity transformations and spatial filtering

Spatial domain processing :

1)     intensity (gray level) transformations

2)     spatial filtering

g (x,y) = T [f (x,y)]  : general form of spatial filtering

f is the input image and g is the output image , T is an operator on f , defined over a specified neighbourhood about point (x,y) .

when we work with color images , intensity is used to denote a color image component certain color spaces .

Function imadjust

A basic image processing toolbox tool for intensity transformations of gray scale .

G = imadjust (f,[low_in high_in],[low_out high_out], gamma)

This function maps the intensity values in image f to new values in g , such that values between  low_in and high_in values between low_out and high_out values .

Values less than low_in and above high_in clipped  . It means that values above high_in map to high_out and values less than low_in clipped to low_out .

The input and output image is the same class; unit8 unit 16 etc .

>> f = imread (‘40977.jpg’);

>> g = imadjust(f,[0 1],[1 0]);

>> imshow (g)

This is the digital equivalent of obtaining a photographic negative , useful for enhancing white or gray detail embedded in a large , predominantly dark region .

Negative of an image can also be called with imcomplement function.

>>  g = imcomplement(f);

>> imshow (g);

Ex :

>> g2 = imadjust (f,[0.5 0.75],[0 1]);

>> imshow (g2)

This example expands the gray scale region 0.5 and 0.75 to the full 0 1 range . It is great for highlighting an intensity band of ineterest .

Ex :

>> g3  = imadjust (f,[],[],2);

>> imshow (g3)

More gray tones …

Logarithmic and Contrast-Stretching Tranformations

Basic tools for dynamic range manipulation .

G = c*log(1+double(f))

C is a constant . Shape is similar to the gamma curve .

It is also used to compress dynamic range . For example , it is not unsual to have a Fourier spectrum with values in the range [0 10^6] or higher . When we display it on the monitor  , it is scaled linearly to 8 bits , high values dominate the display , resulting in lost visual detail for lower intensity values in the spectrum .

By computing the log , a dynamic range on the order of , for example 10^6 , is reduced to approximately 14 , which is much more manageable .

While working logarithmic transformation , it is often desirable to bring the resulting compressed values back to the full range display .

For 8 bits , it is easily done like that :

G4= im2unit8 (mat2gray(g));  % using mat2gray brings the values to the range [0 1] and im2unit8 brings them to the range [0 255]

Later this transformations will be easier .

Contrast-Stretching Function

Compresses the input levels lower than m into a narrow range of dark levels in the output image ; it compress the values above m into a narrow band of light levels in the output . Result is an image of higher contrast .

This limiting function called thresholding function , a simple tool used for image segmentation .

S = T(r) = 1/ (m/r)^E

E controls the slope of the function .

We  can implement this  in Matlab like that ;

G = 1./(1+double(f)+eps)).^E

(suppose E is 20)

Use of eps prevents any overflow if f has any 0 values

 

See you !

Reklamlar

Ocak 11, 2011 Posted by | Image Processing | , , , | Yorum bırakın