LINEAR AND NONLINEAR FILTER FOR IMAGE PROCESSING USING MATLAB’S IMAGE PROCESSING TOOLBOX This report is submitted to the School of Engineering and Information Technology, Murdoch University as a partial fulfilment of the requirement for the Bachelor of Engineering (Honours) FATIHAH MOHD PADZIL PROJECT SUPERVISOR: DR. GREGORY CREBBIN JANUARY, 2016
65
Embed
Linear and Nonlinear Image Processing Filter · LINEAR AND NONLINEAR IMAGE PROCESSING FILTER 1 1. INTRODUCTION 1.1 PROBLEM SCOPE In the modern world, digital images are necessary
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
LINEAR AND NONLINEAR FILTER FOR
IMAGE PROCESSING USING
MATLAB’S IMAGE PROCESSING
TOOLBOX
This report is submitted to the School of Engineering and Information
Technology, Murdoch University as a partial fulfilment of the requirement for
the Bachelor of Engineering (Honours)
FATIHAH MOHD PADZIL
PROJECT SUPERVISOR:
DR. GREGORY CREBBIN
JANUARY, 2016
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
i
ACKNOWLEDGEMENT
Firstly, I would like to take this opportunity to express my sincere gratitude to my supervisor,
Dr. Gregory Crebbin, who was always there to listen and give advice with patience and a
smile on his face, despite his busy schedule. His valuable comments, guidance and constant
encouragement gave me motivation to finish this project. Also, I cannot forget to thank Dr.
Linh Vu, as my second supervisor, and the School of Engineering and Information
Technology for their support throughout this project.
Finally, to all my family and friends, I would like to send my deep appreciation and respect
for their continuous support and encouragement throughout my thesis and entire degree.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
ii
ABSTRACT
The proposal of the thesis is basically to study techniques in digital image processing. This
thesis will cover two image processing areas, which are image restoration and image
enhancement. More specifically, image restoration will involve the removal of noise and
image enhancement will look into technique for edge enhancement.
In this project, two classes of filter will be introduced, which are linear and nonlinear filters.
Two type of noise source will be used which are Gaussian noise and salt and pepper noise.
For noise removal, the mean filter is used as example of a linear filter and the median filter is
used as an example of a nonlinear filter. For edge enhancement, only a linear filter is used,
which is the unsharp mask filter.
The simulation programs are written using the Image Processing Toolbox in MATLAB
(MATrix LABoratory). Test images that corrupted by noise will be used in investigations to
assess the strength and weakness for each type of filter.
ABSTRACT ................................................................................................................................................ ii
TABLE OF CONTENTS .............................................................................................................................. iii
The median value of 0.7255 replaces the original value, as shown in Figure 13. The process is
repeated at the next pixel until all pixels are processed. The same method could be applied to
a 5 x5 median filter but this time 25 neighborhood pixels would be sorted.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
29
3.3 EDGE ENHANCEMENT
The purpose of this section is to describe a method of operation that is used to complete
the simulation program for image sharpening by using an unsharp mask filter. As discussed
in Section 2.6.1, the unsharp mask filter is a technique that is used to increases the sharpness
of the image by using a blurred image of the original input image.
3.3.1 Process Plan
In this section, the image sharpening was simulated by following the flow diagram shown in
Figure 14.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
30
Figure 14: Process flow of image sharpening by unsharp mask filter
Read
• Input image
Convert
• Double precision
Blur
• Using mean filter 3 by 3 window
Subtract
• Original image with filtered image
Choose
• Scaling constant, k
Add
• Original image with blurry image
Display
• Original image and sharpening image
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
31
The simulation for edge enhancement is based on the unsharp masking theory
(Solomon 2010) (Marques 2011). Firstly, the image was read by using the imread function.
The image input values that range from 0 to 255 in the uint8 data class are converted to the
double precision data class with values that range from 0.0 to 1.0. This allows for more
precise calculation when the arithmetic operations of addition, and subtraction are done.
Next, the input image is filtered with a 3 x 3 mean filter to obtain the blurred image
from an original image. The blurred image is now subtracted from the original image to get
an edge image. The edge detect image will be displayed together with the final result.
Then, the scaling constant k is chosen. It can be varied manually in this simulation
program. After the scaling constant k is chosen, each pixel in the edge images is scaled by k
and then is added back into the original image to obtain the edge sharpened image. The image
edge enhancement was tested using three different values of scaling constant.
Lastly, the blurred image, the edge image and the enhanced image are displayed
together in the “Figure 1” window.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
32
4 RESULTS
In this section the results from this project are presented. The results are in the form of
filtered images and mean square error measurements. For noise removal technique, two types
of noise are added to the input image. The filtered image is then compared to the original
noise-free image and noisy image. The results will show how effective the filters are at
removing the different kinds of noise in the image. For edge enhancement, three different
scaling factors are compared to find scaling factor that gives the best enhancement of the
edges in the image.
4.1 MATHEMATICAL RULES
The mean square error (MSE) is chosen as an objective metric for deciding which
type of filter is best at removing the different types of noise. MSE is widely used in image
processing (Kaiwen Zhang 2002). It measures overall gray-value difference between pixels of
the reference image and the filtered image for the entire image without considering
correlation between the neighborhood pixels. The MSE is defined as:
𝑀𝑆𝐸 =1
𝑚𝑛 ∑ ∑(𝑥𝑜𝑟𝑖𝑔𝑖𝑛𝑎𝑙(𝑚, 𝑛) −
𝑛
𝑥𝑓𝑖𝑙𝑡𝑒𝑟𝑒𝑑(𝑚, 𝑛))2
𝑚
Pixels are treated individually so all pixels in the image are equally important. As a
human observer, some pixels errors may cause more significant visual effects than other
pixels errors, but MSE would assign the same error value to both pixels. The greatest quality
is when the MSE equal to zero. The smaller MSE, the better the filter for filtering that type of
noise.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
33
4.2 MEAN FILTER RESULT
4.2.1 Result of 3 by 3 filtered image
The first result that is presented are for the 3-by-3 mean filter applied to images with
both type of noise. From Figure 15 and Figure 16, the filtered image give evidence of less
noise than the unfiltered noisy image. The noise tends to be removed but some details such as
edges, becomes blurred so, while the mean filter can remove the noise, it tends to blur the
image.
Figure 15: 3-by-3 Mean filter with salt and pepper noise
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
34
Figure 16: 3-by-3 Mean Filter with Gaussian Noise
The Gaussian noise is removed more effectively with the mean filter compared to salt
and pepper noise. The salt and pepper noise becomes blurred but is not removed. The mean-
square-errors support these observations. The MSE value is calculated for, the original to the
noise added image, and the original image to the filtered image. The values are recorded in
Table 2.
Table 2: MSE value for mean filter
Gaussian Salt and pepper
Original image and noise added image 0.01617 0.01753
Original image and filtered image 0.00425 0.0464
From the table, the filtered Gaussian noise image has the smallest MSE value, which
shows that the mean filter removes Gaussian noise better than it removes salt and pepper
noise.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
35
4.2.2 Result of 5 by 5 filtered image
This is result that is presented are for the 5-by-5 mean filter applied to images with
both type of noise. Figure 17 shows the 5 by 5 mean filter with salt and pepper noise and
Figure 18 shows the 5-by-5 mean filter with Gaussian noise. From the image review, the both
image became more blurred because the mean filter tends to blur the noise instead of reduce
it. It shows that window 5-by-5 mean filter not really suitable to uses when to reduce the
noise.
Figure 17: 5-by-5 mean filter with salt and pepper noise
Figure 18: 5-by-5 mean filter wit Gaussian noise
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
36
Table 3: MSE value for 5-by-5 mean filter
Gaussian Salt and pepper
Original image and noise added image 0.01789 0.01800
Original image and filtered image 0.00524 0.00575
The MSE value for 5-by-5 mean filter is recorded in Table 3. From the table, with the
almost same noise- added to the image, the Gaussian noise is seen to be more reduce from the
image but the both image filtered look more blurred.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
37
4.3 MEDIAN FILTER RESULT
4.3.1 Result of 3 by 3 filtered image
The median filter has uses in image processing because it is the simplest nonlinear
filter that can produce interesting results. Figure 19 shows an image with salt and pepper
noise that is filtered by 3 x 3 median filter, while Figure 20 shows Gaussian noise that is
filtered by the same median filter.
Both types of noise are reduced in the image, but by looking at Figure 19, it is clear
that salt and pepper noise has being removed more effectively than the Gaussian noise. From
these images, the median filter is not only good at removing the noise but also at preserving
the edges of the image. It is clear that the median filter works better when removing the salt
and pepper noise compared to removing Gaussian noise.
Figure 19: 3-by-3 median filtered image with salt & pepper noise
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
38
Figure 20: 3-by-3 median filtered image with Gaussian noise
The MSE value for the median filter is calculated between the original and the noise-
added image, and between the original image and the filtered image. The MSE for both types
of noise are recorded in Table 4. From the table, the filtered salt and pepper noise image has
the smallest MSE value, which is near to zero. By comparing Table 2 and Table 4, the
median filter is considerably more effective than mean filter in removing salt and pepper
noise.
Table 4: MSE value for median filter
Gaussian Salt and pepper
Original image and noise added image 0.01630 0.01750
Original image and filtered image 0.00473 0.00126
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
39
4.3.2 Result of 5 by 5 filtered image
This is result that is presented are for the 5-by-5 median filter applied to images with
both type of noise. Figure 21 shows the 5-by-5 median filter with salt and pepper noise and
Figure 22 shows the 5-by-5 median filter with Gaussian noise.
Figure 21: 5-by-5 median filtered image with salt & pepper noise
Figure 22: 5-by-5 median filtered image with Gaussian noise
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
40
From the image review, for salt and pepper noise clearly can see the noise is remove
from the image and still have some edge is preserved. For Gaussian noise, the image become
a bit blurred but still good when compare to the 5-by-5 mean filter.
The mean-square-errors support these observations. The MSE value is calculated for,
the original to the noise added image, and the original image to the filtered image. The values
are recorded in Table 5.
Table 5: MSE value for 5 by 5 median filter
Gaussian Salt and pepper
Original image and noise added image 0.01699 0.01768
Original image and filtered image 0.00407 0.00232
From the table, the salt and pepper noise is seen to work better than the Gaussian noise
when to remove the noise using median filter. By comparing to window of median filter, 3-
by-3 window is work better than the 5-by-5 window filter.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
41
4.4 RESULT OF 11-BY-11 WINDOW FILTER
The uses of larger windows for mean and median filter were also studied. A window
of size 11-by-11 was chosen. The result are not included here because the larger windows
caused the image to become more blurring, especially when using mean filter on salt and
pepper noise which is not effective at all. The results for 11-by11 mean filter and 11-by-
11median filter are included in Appendix A of this thesis.
4.5 UNSHARP MASK FILTER RESULT
The unsharp masking filter is one technique for edge enhancement. Figure 19 shows
the blurred image resulting from the application of a 3 by 3 mean filter to the input image.
The blurred image is then subtracted from the original image to obtain the edge difference
image, as shown in Figure 23. The final enhancement images based on using different scaling
constants is shown in Figure 24.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
42
Figure 23: Result of blurring with mean filter
Figure 24: The edge image
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
43
k= 0.2
MSE = 0.00009
k= 0.5
MSE =0.00056
K= 0.7
MSE = 0.00110
k= 0.8
MSE =0.00143
k=7
MSE = 0.109
K=11
MSE= 0.27126
Figure 25: Image edge enhancement with different scaling constant k
The results in Figure 25 show that by increasing the parameter k, the degree of
enhancement increases but the noise within the image becomes more apparent. The different
values of k that were used are 0.2, 0.5, 0.7, 0.8, 1.0 and 11. A value of 0.8 is upper value for
k, beyond which the noise effects become more severe.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
44
4.6 RESULT SUMMARY
In this section the findings of this project are summarized here. For noise removal
technique, two type of noise is added which is salt-and-pepper and Gaussian noise and two
type of filter is apply to remove this noise.
For linear filter example is mean filter, works better when removing the Gaussian noise
compared to removing the salt and pepper noise. For nonlinear filter example is median filter.
Median filter are introduced to overcome the limitation of mean filter so it works better when
removing the salt and pepper noise comparing to removing Gaussian noise. But median filter
not only remove the noise but also preserve the edges of image. For noise removal, only
small size of window is consider to use for removing noise. This can see when the bigger size
of window is applied the image tends to become more blurred when filtering job is done.
For edge enhancement, three different scaling factors are compared to find scaling
factor that gives the best enhancement of the edges in the image. The k value is measured
from k = 0.2 to 11. Results from Figure 25 shows that the degree of enhancement, 0.8 is
chosen because the edge is enhance nicely without amplify the false edge (noise). The false
edge is amplify can clearly see on when k = 11 compared to the original image.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
45
5 PROBLEM ENCOUNTERED AND COUNTERMEASURES
During the progress plan stage of this project a few of problem were encountered.
Corrective action was taken to ensure this project and thesis could be completed according to
the plan and design.
The first problem that was identified was that Murdoch University only has one
license for the MATLAB Image Processing Toolbox. This license only could be accessed
from a special server which is ENGEN2 and only one person can accessed the toolbox at the
time. To solve this problem, a request was sent to the technician, Will Stirling, to open this
server.
The second problem was the limited resources in the library. There were only a
limited number of book for image processing. A few useful books could not be found either
in hardcopy or e-book format from library resources. There are also a lot of journal articles
available but the books have more detail explanation about MATLAB code. The
countermeasure for this problem was to borrow a book from the supervisor.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
46
6 CONCLUSION AND RECOMMENDATIONS
6.1 CONCLUSION
In conclusion, different filters have different strengths and weaknesses. So different
types of filter are needed when solving image processing problems. Sometimes a nonlinear
filter may work better than a linear filter. In image restoration, the nonlinear filter can do a
better job that the linear filter. As seen in the results, while the linear filter can remove the
noise, the nonlinear filter not only removes the noise but also can preserve edges. This is
why, not just a single filter is needed to remove noise, but a range of filters are needed,
depending on the situation encountered.
In summary, this project had archieved its main objective to develop a simulation
program in MATLAB using the Image Processing Toolbox. Basic knowledge about image
processing was introduced in the literature review chapter. Both linear and nonlinear filters
for specific image processing tasks were designed: the mean filter as a linear filter type and
the median filter as a nonlinear filter type. The requirements of the filters to remove
unwanted artefacts (noise) and to enhance edges were identified.
Lastly, with this thesis, the main achievement when developing these programs, was
that the theoretical and practical knowledge gained from three years study at Murdoch could
be applied to a new problem. This is a significant achievement because it helped develop the
skills in programming, troubleshooting and system design.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
47
6.2 RECOMMENDATIONS
Due to the time limitation, there is still a lot of works that could be done in this area.
Following the investigations described in this thesis, a number of more advanced image
processing tasks could be investigated:
- The simulation programs were limited to basic applications of image processing;
the existing program could be extended to other application such as object
identification and image coding.
- The simulations used only a gray-level image. The next step would be to upgrade
to using color images.
- Other enhancement methods can be applied to enhance the edges of images such
as the Laplacian-based method (Solomon 2010).
- The simulation program was built by using the MATLAB Image Processing
Toolbox. It is possible to build simulators using other toolbox such as signal and
processing toolbox and computer vision toolboxes.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
48
7 REFERENCES
Abdul Rasak Zubair, Olasebikan Alade Fakolujo. "International Journal of Computer and Information
Technology." Image Edge Detection and Image Edge Enhancement: Numerical experiment on
High Pass Spatial Filtering, 2014: 772-781.
Ajay Kumar Boyat, Brijendra Kumar Joshi. "A Review Paper." Noise Models in Digital Image
Processing, April 2015.
Bovik, Alan C. The Essential Guide to Image Processing 2nd Edition. London, UK: Academic Press,
2009.
Jae S. Lim. Two- Dimensional Signal and Image Processing. Englewoods Cliff, NJ: Prentice Hall, 1990.
Jaehne, Bernd. Digital Image Processing. Heidelberg, Germany: Springer-Verlag Berlin, 2005.
Kaiwen Zhang, Shouzhong Wang, Xiepen Zhang. A New Metric for Quality Assesment of Digital Image
Based on Weighed-Mean Square Error, 2002.
Marques, Oge. Practical Image and Video Processing Using Matlab. Somerset, NJ , USA: John Wiley &
Son, 2011.
Russ, John C. The Image Processing Handbook 5th Edition. Raleigh, North Carolina: Taylor & Francis
Group, 2007.
SIPI. Signal and Image Processing Institute, University of Southern California. 2015.
http://sipi.usc.edu/database/ (accessed September 2015, 1).
Solomon Chris, Toby Brecken. In Fundamental of Digital Image Processing: A Practical Approach with
Example in Matlab. Hoboken, NJ: John Wiley & Son, 2010.
Tan, Li. Digital Signal Processing : Fundamentals and Applications. Burlington, MA, USA: Academic
Press, 2007.
The MathWorks Inc. 2016. http://au.mathworks.com/help/images/product-description.html
(accessed December 2015).
Zubair, Abdul Rasak. "International Journal of Research in Commence, IT & Management."
Comparison of Image Enhancement Techniques, 2012.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
49
8 APPENDIX
8.1 APPENDIX A
Result for a 11 by 11 mean filter
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
50
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
51
Result for a 11 by 11 median filter.
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
52
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
53
8.2 APPENDIX B
Appendix B shows the Matlab code for noise removal by a mean filter.
clc; clear;
% Read image. I = imread('C:\Users\32112635\Documents\MATLAB\Thesis Ariesa\clock.tiff');
[r c]=size(I)
%convert image to double precesion Id = im2double (I);
% Apply salt and pepper noise to image using |imnoise| . Isp = imnoise(Id,'salt & pepper',0.05);
% Apply gaussian noise to image using |imnoise| . Ig = imnoise(Id,'gaussian',0,0.02);
%predefined filter NxN window (mean filter) n = input ('enter the window size of MEAN Filter, (n for NxN matrix):');
%specify window size mean = ones (n,n)/(n*n)
%imfilter=computes each element of the output,using double-precision
floating point. %for salt and pepper noise Ispf = imfilter (Isp,mean);
%for gaussian noise Igf = imfilter (Ig,mean);
% Display original image and noise image for comparison. figure (1) subplot (1,2,1), imshow(Isp) title ('Image with Noise (Salt&Pepper)') subplot (1,2,2), imshow(Ispf) title ('Filtered Image Using Mean Filter')
% Display original image and noise image for comparison. figure (2) subplot (1,2,1), imshow(Ig) title ('Image with Noise (Gaussian)') subplot (1,2,2), imshow(Igf) title ('Filtered Image Using Mean Filter')
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
54
%-------------------MSE-------------------- % 1st try % ORIGINAL - FILTERED IMAGE diffg = ( Id -Ispf).^2; MSE1= sum(sum(diffg))/ (r*c); fprintf('\n\nORIGINAL IMAGE AND FILTERED IMAGE') fprintf('\nThe Mse value for Salt and pepper noise is: %.5f', MSE1);
diffg = ( Id -Igf).^2; MSE2= sum(sum(diffg))/ (r*c); fprintf('\nThe Mse value for Gaussian noise is: %.5f', MSE2);
diffg = ( Id -Isp).^2; MSe1= sum(sum(diffg))/ (r*c); fprintf('\n\nORIGINAL IMAGE AND NOISE ADDED IMAGE'); fprintf('\nThe Mse value for salt and pepper noise is: %.5f', MSe1);
diffg = ( Id -Ig).^2; MSe2= sum(sum(diffg))/ (r*c); fprintf('\nThe Mse value for Gaussian noise is: %.5f', MSe2);
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
55
8.3 APPENDIX C
Appendix C shows the Matlab code for noise removal by a median filter.
clc; clear;
% Read image. I = imread('C:\Users\32112635\Documents\MATLAB\Thesis Ariesa\clock.tiff');
%convert image to double precesion Id = im2double (I); [r c] = size (I) % Apply salt and pepper noise to image using |imnoise| . Isp = imnoise(Id,'salt & pepper',0.05);
% Apply gaussian noise to image using |imnoise| . Ig = imnoise(Id,'gaussian',0,0.02);
%predefined filter NxN window (mean filter) n = input ('enter the window size of MEDIAN Filter, (n for NxN matrix):');
%specify window size
%B = medfilt2(A, [m n]) performs median filtering, where each output pixel % contains the median value in the m-by-n
% neighborhood around the corresponding pixel in the
% input image.
%median = medfilt2 ((image_noise,[n n]); %median filter with NxN window
% %for salt and pepper noise Ispf = medfilt2 (Isp,[n n]);
%for gaussian noise Igf = medfilt2 (Ig, [n n]);
% Display original image and noise image for comparison. figure (1) subplot (1,2,1), imshow(Isp) title ('Image with Noise (Salt&Pepper)') subplot (1,2,2), imshow(Ispf) title ('Filtered Image Using Median Filter')
% Display original image and noise image for comparison. figure (2) subplot (1,2,1), imshow(Ig) title ('Image with Noise (Gaussian)') subplot (1,2,2), imshow(Igf) title ('Filtered Image Using Median Filter')
%------------------Mean Square Error--------------- %--- calculates the MSE. % calculates the "square error" image. % change to double so that we can get negative differences. %--------------------------------------------------------\
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
56
%-------------------MSE-------------------- % 1st try % ORIGINAL - FILTERED IMAGE diffg = ( Id -Ispf).^2; MSE1= sum(sum(diffg))/ (r*c); fprintf('\n\nORIGINAL IMAGE AND FILTERED IMAGE') fprintf('\nThe Mse value for Salt and pepper noise is: %.5f', MSE1);
diffg = ( Id -Igf).^2; MSE2= sum(sum(diffg))/ (r*c); fprintf('\nThe Mse value for Gaussian noise is: %.5f', MSE2);
diffg = ( Id -Isp).^2; MSe1= sum(sum(diffg))/ (r*c); fprintf('\n\nORIGINAL IMAGE AND NOISE ADDED IMAGE'); fprintf('\nThe Mse value for salt and pepper noise is: %.5f', MSe1);
diffg = ( Id -Ig).^2; MSe2= sum(sum(diffg))/ (r*c); fprintf('\nThe Mse value for Gaussian noise is: %.5f\n\n', MSe2);
LINEAR AND NONLINEAR IMAGE PROCESSING FILTER
57
8.4 APPENDIX D
Appendix C shows the Matlab code for an unsharp mask filter.
clc; clear;
% Read image.
I = imread('C:\Users\32112635\Documents\MATLAB\Thesis Ariesa\clock.tiff');
[r c] = size (I)
%convert image to double precesion Id = im2double (I);
%--------smoothes by 3x3 mean filter mean = ones (3,3)/(3*3) smooth = imfilter (Id,mean);
edge= Id- smooth;
k = input ('enter the scaling constant,k:'); sharp1 = Id + k*(edge);
figure(1) imshow(smooth); title ('Blurred Image');