Edge Detection in Matrix Form

Hi my main problem is how can i detect edges in 3x3 matrix not image my values are
matrix 7 8 9;4 5 6;1 2 3
edge detector 1 2 3; 4 5 6; 7 8 9
please help me for detecting matrix edges with convolution

Respuestas (1)

Image Analyst
Image Analyst el 19 de Dic. de 2018

0 votos

Try this:
grayImage = imread('moon.tif');
subplot(1, 2, 1);
imshow(grayImage, []);
impixelinfo
edgeDetector = [1 2 3; 4 5 6; 7 8 9]; % Not a good edge detector!
edgeDetector = [1 1 1; 0 0 0; -1 -1 -1]; % Better edge detector.
filteredImage = conv2(double(grayImage), edgeDetector, 'same');
subplot(1, 2, 2);
imshow(filteredImage, []);
impixelinfo
0000 Screenshot.png

3 comentarios

can evkuran
can evkuran el 19 de Dic. de 2018
Thanks for help but i need to do in matrix form not image i have a matrix (7 8 9; 4 5 6; 1 2 3) main problem is detecting edges on this matrix not image form
Image Analyst
Image Analyst el 19 de Dic. de 2018
So just replace the moon image with your image or matrix. I thought you'd understand to do that, but anyway, here it is:
matrix = [7 8 9; 4 5 6; 1 2 3]
subplot(1, 2, 1);
imshow(matrix, []);
impixelinfo
edgeDetector = [1 2 3; 4 5 6; 7 8 9]; % Not a good edge detector!
% edgeDetector = [1 1 1; 0 0 0; -1 -1 -1]; % Better edge detector.
filteredImage = conv2(matrix, edgeDetector, 'same');
subplot(1, 2, 2);
imshow(filteredImage, []);
impixelinfo
0000 Screenshot.png
Now, you know that the filter window can only fit complete inside your matrix at ONE location, don't you?
can evkuran
can evkuran el 19 de Dic. de 2018
I understand now thanks for your help. if i have a problem ı wıll type here regards

Iniciar sesión para comentar.

Etiquetas

Preguntada:

el 19 de Dic. de 2018

Comentada:

el 19 de Dic. de 2018

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by