0% found this document useful (0 votes)
40 views

EECS 490 Lecture16

This document discusses using MATLAB and its image processing toolbox to perform edge detection and Fourier transforms on images. It provides examples of using different edge detection methods like Sobel, Canny, and Laplacian of Gaussian on an image. It also demonstrates how to take the 2D Fourier transform of an image and visualize it.

Uploaded by

Winswept
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views

EECS 490 Lecture16

This document discusses using MATLAB and its image processing toolbox to perform edge detection and Fourier transforms on images. It provides examples of using different edge detection methods like Sobel, Canny, and Laplacian of Gaussian on an image. It also demonstrates how to take the 2D Fourier transform of an image and visualize it.

Uploaded by

Winswept
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 15

Digital Image Processing using MATLAB www.imageprocessingbook.

com

MATLAB/Image Processing Toolbox


MATLABs edge detection routines % % % % % [g,t] = edge (f, method, parameters) f is input image, g is output image t is an optional threshold for the output image method can be sobel, prewitt, roberts, laplacian of a gaussian, zero crossings, or Canny

>> f=imread(fig10.10(a).jpg); %load in building figure >> [g_sobel_default,0.074]=edge(f,sobel); % figure 10.7(a) >> [g_log_default, 0.0025]=edge(f, log); % figure 10.7(c) % log is short for laplacian of a Gaussian >> [g_canny_default, [0.019,0.047]]=edge(f,canny); % figure 10.7(e) % hand optimized functions >> g_sobel_best=edge(f,sobel, 0.05); % figure 10.7(b) %0.05 is a threshold for the output >> g_log_best=edge(f, log,0.003, 2.25); % figure 10.7(d) %0.003 is the output threshold and 2.25 is the standard deviation of the Gaussian >> g_canny_best=edge(f,canny, [0.04,0.10],1.5); % figure 10.7(f) %0.04 and 0.10 are the output thresholds and 1.5 is the standard deviation of the Gaussian

SEE GWE, Section 10.1.3 Edge Detection Using Function edge

2002 R. C. Gonzalez & R. E. Woods

15

Digital Image Processing using MATLAB www.imageprocessingbook.com

MATLAB/Image Processing Toolbox


MATLAB Fourier transforms >> >> >> >> >> >> f=imread(Figure_Rectangle.jpg); F=fft2(f); S=abs(F); imshow(S, [ ]) Fc=fftshift(F); imshow(abs(Fc), [ ]); % load in spatial rectangle % do 2D FFT % determine magnitude for display % shows in four corners of display % shift FFT to center % show magnitude of FFT in center

% much tougher to do display transform >> g=im2unit8(mat2gray(log(1+double(f)))); >> imshow(g) % double converts the image to double precision floating point % mat2gray brings the values to the range [0,1] % im2unit8 brings the values back to the range [0,255] % general log transform >> g=im2unit8(mat2gray(c*log(1+double(f))));

SEE GWE, Section 4.2 Computing and Visualizing the 2-D DFT in MATLAB GWE, Section 3.2.2 Logarithmic and Contrast Stretching Transformations

2002 R. C. Gonzalez & R. E. Woods

14

You might also like