Question about Sobel filter
Show older comments
Question: Below is the matrix of a 10x10 image. Using a 3x3 kernel, apply the mean, median, laplas (4-neighborhood absolute result) and sobel operators (x-y direction together) to the relevant pixel of the image using the i and j indices given in the table next to your name.
I need Sobel code that find the results above.
For example:T=medfilt2(A,[3 3]); for Median.


For example, I have a matrix of any picture.
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]
T=medfilt2(A,[3 3]);
T(5,5) % The answer is 12
A=uint8(A);
H=fspecial('average',[3 3]);
T=imfilter(A,H);
T(3,3) % The answer is 13
A=uint8(A);
H = fspecial('laplacian',0.2)
T=imfilter(A,H);
I don't know sobel code how to use for this question. If you help me, i will be very happy.
Answers (1)
Image Analyst
on 11 Feb 2021
0 votes
You can try medfilt2(), imgradient(), and imfilter() or conv2().
Categories
Find more on Image Filtering in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!