clc
clear
%DoG滤波器
p2 = input('模板尺寸p2=\n');
display('DoG算子的方差设置 方差1<方差2')
sigma1 = input('方差1 sigma1=\n');
sigma2 = input('方差2 sigma2=\n');
siz = (p2-1)/2;
[x,y] = meshgrid(-siz(1):1:siz(1),-siz(2):1:siz(2));
z1 = exp(-(x.*x+y.*y)/(2*sigma1.^2))/sqrt(2*pi*sigma1.^2);
z2 = exp(-(x.*x+y.*y)/(2*sigma2.^2))/sqrt(2*pi*sigma2.^2);
z3 = z1 -z2;
figure
mesh(x,y,z1)
hold on
mesh(x,y,z2)
Inimage = imread('aa.bmp');
figure
imshow(Inimage)
Inimage = rgb2gray(Inimage);
Resimage = conv2(Inimage, z3,'full');
Resimage = mat2gray(Resimage);
figure
imshow(Resimage)
- 1
- 2
- 3
- 4
- 5
- 6
前往页