close all;
im = imread('girl.BMP');
imshow(im);
imwrite(im,'girl.jpg')
I=double(im);
G = fspecial('gaussian', [5 5], 2);
%高斯模糊
Ig = imfilter(I,G,'same');
figure;imshow(uint8(Ig));
imwrite(uint8(Ig),'blur_girl.jpg');
%sobel
a=0.2;
h1=[-1 0 1;-2 1 2;-1 0 1];
h2=[1 2 1;0 1 0;-1 -2 -1];
J1=conv2(Ig,h1,'same');
K1=uint8(J1);
imwrite(K1,'girlsobel_x.jpg');
figure;imshow(K1);
J2=conv2(Ig,h2,'same');
K2=uint8(J2);
imwrite(K2,'girlsobel_y.jpg');
figure;imshow(K2);
%LoG
a=0.2;
h = fspecial('log', [5 5], 0.3);
h=-a*h;
h(3,3)=h(3,3)+1;
bw = conv2(Ig, h, 'same');
bw = uint8(bw);
imwrite(bw,strcat('girl_LoG.jpg'));
figure;imshow(bw);