% ============================================================================= % Math 336 - Image Processing - Laboratory 3 % % A Matlab script for applying the edge detection filters to the image % TSA.jpg. % % Marty Kandes % Department of Physics % San Diego State University % Fall 2008 % ----------------------------------------------------------------------------- clear all; close all; clc; f = imread('tsa.jpg'); f = mat2gray(f); h = [0,0,0;0,1,0;0,0,0]; g = imfilter(f,h,'replicate'); g = mat2gray(g); figure; subplot(1,2,1), imshow(f); subplot(1,2,2), imshow(g); clear all; close all; clc; f = imread('tsa.jpg'); f = mat2gray(f); h = [0,0,0;0,1,0;0,0,-1]; g = imfilter(f,h,'replicate'); g = mat2gray(g); figure; subplot(1,2,1), imshow(f); subplot(1,2,2), imshow(g); clear all; close all; clc; f = imread('tsa.jpg'); f = mat2gray(f); h = [1,2,1;0,0,0;-1,-2,-1]; g = imfilter(f,h,'replicate'); g = mat2gray(g); figure; subplot(1,2,1), imshow(f); subplot(1,2,2), imshow(g); clear all; close all; clc; f = imread('tsa.jpg'); f = mat2gray(f); k = 8; h = [-k/8,-k/8,-k/8;-k/8,1+k,-k/8;-k/8,-k/8,-k/8]; g = imfilter(f,h,'replicate'); g = mat2gray(g); figure; subplot(1,2,1), imshow(f); subplot(1,2,2), imshow(g); clear all; close all; clc; f = imread('tsa.jpg'); f = mat2gray(f); k = 4; h = [-k/8,-k/8,-k/8;-k/8,1+k,-k/8;-k/8,-k/8,-k/8]; g = imfilter(f,h,'replicate'); g = mat2gray(g); figure; subplot(1,2,1), imshow(f); subplot(1,2,2), imshow(g); clear all; close all; clc; f = imread('tsa.jpg'); f = mat2gray(f); k = 6; h = [-k/8,-k/8,-k/8;-k/8,1+k,-k/8;-k/8,-k/8,-k/8]; g = imfilter(f,h,'replicate'); g = mat2gray(g); figure; subplot(1,2,1), imshow(f); subplot(1,2,2), imshow(g); clear all; close all; clc; f = imread('tsa.jpg'); f = mat2gray(f); k = 8; h = [-k/8,-k/8,-k/8;-k/8,1+k,-k/8;-k/8,-k/8,-k/8]; g = imfilter(f,h,'replicate'); g = mat2gray(g); figure; subplot(1,2,1), imshow(f); subplot(1,2,2), imshow(g);