Recognize edges in mosaic-like background - draw horizontal lines and save line coordinates
Mostrar comentarios más antiguos
Hello,
I am looking for a good automated method to find the edges of the horizontal gray surfaces in the mosaic background. The edges should be displayed with horizontal lines (like Sample.jpg). The gray surfaces could be a little tilted, but it's enough for me if the lines are displayed horizontally,
Thx
Respuesta aceptada
Más respuestas (1)
Big caveat: I'm not even close to an image processing expert so there is probably a smarter way to do this.
I noticed that the two bands seem to have a more uniform grey, while the rest of the fabric (?) is more black and white, so I decided to use the standard deviations of the rows to look for the edges.
im = imread('1.jpg');
img = im2gray(im);
ims = imshow(img);
rowmean = mean(img, 2);
rowstd = std(double(img), 0, 2);
plot(rowstd)
xline([280 385 805 930]) % <<< I experimented with changing these numbers to line up on the "edges"
grid on
Now I've found the row numbers in the image that define the "edges".
Unfortunately, I couldn't figure out how to draw the lines on top of the image.
1 comentario
Tommy Schumacher
el 8 de Nov. de 2023
Categorías
Más información sobre Matrix Indexing en Centro de ayuda y File Exchange.
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!


