Assignment #2 DSP Blurring and Deblurring
1-Alaa Moustafa Muhammad #4 2-Mayada Muhammad Abd el aty #73
Source code:
%convolution A = imread('[Link]'); img2gray = rgb2gray(A); h = fspecial('prewitt'); sizeA = size(img2gray); y = fft2(h,sizeA(1,1),sizeA(1,2)); z = fft2(img2gray); img = z .* y; i=ifft2(img); figure imshow(uint8(i));
%deconvolution original_img = img ./ y ; i2=ifft2(original_img); figure imshow(uint8(i2));
1|Page
Figures: Original image
Laplacian
2|Page
Motion
Gaussian
3|Page
Laplacian Gaussian
Disk
Unsharpen
4|Page
Prewitt deblurred black image
Averagedeblurred black image:
Sobel
5|Page
6|Page
7|Page
Analaysis:
1- Laplacian Filter: The Laplacian of an image highlights regions of rapid intensity change and is therefore often used for edge detection The Laplacian L(x,y) of an image with pixel intensity values I(x,y) is given by:
Since the input image is represented as a set of discrete pixels, we have to find a discrete convolution kernel that can approximate the second derivatives in the definition of the Laplacian. Two commonly used small kernels are
But we used more accurate array used in matlab 0.1667 0.6667 0.1667 0.6667 -3.3333 0.6667 0.1667 0.6667 0.1667 2- Motion Filter: To compute the filter coefficients, h, for 'motion': Construct an ideal line segment with the desired length and angle, centered at the center coefficient of h. For each coefficient location (i,j), compute the nearest distance between that location and the ideal line segment. h = max(1 - nearest_distance, 0); Normalize h:h = h/(sum(h(:))
8|Page
3- Gaussian Filter: It is used to blur images and remove detail and noise In 2-D Gaussian has the form: Gaussian Distribution
This distribution is shown
The idea of Gaussian smoothing is to use this 2-D distribution as a `point-spread' function, and this is achieved by convolution. Since the image is stored as a collection of discrete pixels we need to produce a discrete approximation to the Gaussian function
9|Page
4- Laplacian/Gaussian filter: To include a smoothing Gaussian filter, combine the Laplacian and Gaussian functions to obtain a single equation:
So I want to eliminate noise on the image transformed by laplacian to detect edges smoothly The LoG operator takes the second derivative of the image. Where the image is basically uniform, the LoG will give zero. Wherever a change occurs, the LoG will give a positive response on the darker side and a negative response on the lighter side. At a sharp edge between two regions, the response will be zero away from the edge positive just to one side negative just to the other side zero at some point in between on the edge itself
5- Disk Filter: All I can find about it is that it is a circular averaging filter (pillbox) within the square matrix of side 2*radius+1. The default radius is 5
10 | P a g e
6- Unsharpen Filter: The unsharp filter is a simple sharpening operator which derives its name from the fact that it enhances edges and other high frequency components in an image via a procedure which subtracts an unsharp, or smoothed, version of an image from the original image Unsharp masking produces an edge image image via from an input
where
is a smoothed version of
11 | P a g e