A list,
1. 【 Abstract 】
Laplace operator, as one of edge detection, is also an integral transform commonly used in engineering mathematics, just like Sobel operator, which belongs to space sharpening filtering operation. The Laplace Operator is a second order differential Operator in n-dimensional Euclidean space, defined as the divergence of the gradient (▽f) (▽·f). Laplacian operators can also be generalized to elliptic operators defined on Riemannian manifons, known as Laplace-Beltrami operators.
2 the principle of
Laplacian operator is a second-order differential linear operator. In image edge processing, the second-order differential has stronger edge positioning ability and better sharpening effect. Therefore, in image edge processing, the second-order differential operator is directly used instead of the first-order differential.
3. Edge algorithm: Laplacian
More sensitive to noise, so that the noise ability component is strengthened, easy to lose part of the edge direction information, resulting in some discontinuous edge detection, and poor anti-noise ability.
Ii. Source code
clc;
clear;
hold off;
I = imread('lena.bmp');
figure(1);
imshow(I);
title(Lena 'original');
% J1 = imnoise(I,'gaussian'.0.0.01); % Gaussian noise % figure(2);
% imshow(J1);
% J2 = imnoise(I,'salt & pepper'.0.02); % salt and pepper noise % figure(3); % imshow(J2); % -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- the second order differential operator edge detection -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- c = [- 1 - 1 - 1% Laplacian operator- 1 8 - 1
- 1 - 1 - 1]
I = double(I);
for j = 2:255
for i = 2:255
b1 = I(j- 1,i- 1);
b2 = I(j- 1,i);
b3 = I(j- 1,i+1);
b4 = I(j,i- 1);
b5 = I(j,i);
b6 = I(j,i+1);
b7 = I(j+1,i- 1);
b8 = I(j+1,i);
b9 = I(j+1,i+1);
buffer(j,i) = b1*c(1.1) + b2*c(1.2) + b3*c(1.3) + b4*c(2.1) + b5*c(2.2) + b6*c(2.3) + b7*c(3.1) + b8*c(3.2) + b9*c(3.3);
J(j,i) = uint8(buffer(j,i));
if J(j,i) < 0
J(j,i) = -J(j,i);
end
if J(j,i) > 255
J(j,i) = 255;
end
end
end
for i = 1:256
J(1,i) = I(1,i);
J(256,i) = I(256,i);
end
for j = 1:256
J(j,1) = I(j,1);
J(j,256) = I(j,256);
end
Copy the code
3. Operation results
Fourth, note
Version: 2014 a