Apply the Laplacian Filter in Matlab
6 views (last 30 days)
Show older comments
I have a question. I tried many time with different codes but i did not find answer. I am not sure in every time about my answer. I wonder how to find answer using with matlab.
I tried codes:
A=[14 12 10 12 11 10 13 7 9 16;
16 14 13 13 12 6 9 10 13 11;
16 14 12 13 11 8 9 11 11 3;
13 13 12 12 15 11 12 12 4 3,
16 9 4 12 14 8 9 21 11 5;
16 15 15 12 8 8 5 5 6 12;
12 11 13 11 13 4 4 3 2 5;
7 7 13 13 14 4 4 3 4 5;
8 11 5 12 12 4 5 4 4 5;
14 14 12 6 12 5 2 3 5 3]
%my first try
kernel = -1 * ones(3);
kernel(2,2) = 8; % Now kernel = [-1,-1,-1; -1,8,-1; -1,-1,-1]
output = conv2(A,kernel,'same');
%my second try
b=[0 1 0; 1 -4 1; 0 1 0]
c=conv2(A,b,'valid')
%my third try
b=[-1,-1,-1; -1,8,-1; -1,-1,-1]
c=conv2(A,b,'valid')
%my 4th try
A=uint8(A);
H = fspecial('laplacian',0,2)
T=imfilter(A,H);
I would be glad if you help.
0 Comments
Answers (0)
See Also
Categories
Find more on Image Processing Toolbox in Help Center and File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!