mean, median, horisontal prewitt, vertical prewitt, horizontal sobel
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
I have this assignment (translated from Danish):
A filtering is done (correlation) with a filter on the picture. Coefficient normalization is not used. The filteret value for the marked pixel is -119. What 3x3 filter is used?
I can't figure out how to use prewitt and sobel when I don't load a picture into matlab but have my own numbers I want to filter. So how does I solve this assignment ?
The picture is 8x8, and the 3x3 picture has the values: [125 103 90; 86 25 209; 230 34 4] where 25 is the marked pixel.
=)
0 comentarios
Respuestas (1)
DGM
el 2 de Mayo de 2023
Since we're only dealing with one window position, this is fairly simple -- but there's one catch.
Let's start by just trying all the possibilites.
% the image content at the given window position
A = [125 103 90; 86 25 209; 230 34 4];
% prewitt and sobel filter kernels (vertical)
fkp = fspecial('prewitt');
fks = fspecial('sobel');
% the result for each operation
mean(A(:))
median(A(:))
sum(A.*fkp,'all') % vertical prewitt
sum(A.*fkp.','all') % horizontal prewitt
sum(A.*fks,'all') % vertical sobel
sum(A.*fks.','all') % horizontal sobel
Neat! It's a vertical Sobel filter ... but why is the sign different? The Sobel and Prewitt filters returned by fspecial() are oriented such that they give the correct sign when used in convolution. What we're simulating here is correlation. You could get the expected result by rotating the filters by 180 degrees, or due to their symmetry, you could just flip the sign.
0 comentarios
Ver también
Categorías
Más información sobre Visual Exploration en Help Center y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!