Centerline detection from the binary image.
6 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
DW
el 22 de Nov. de 2023
I have multiple images taken of the same object.
However, as in the example below, not all objects are located in the center.


I want to identify central axis of the object(based on the standard of ensuring that the length of the light blue arrows is the same as shown in the image below) and indicate the center line and crop the image based on this.

I think I can do the crop itself as long as I know the index of the center line.
It would be very helpful if you could tell me where to start.
Thank you!
#1 Result of Angelo Yeo's code (cropped image)

0 comentarios
Respuesta aceptada
Image Analyst
el 22 de Nov. de 2023
What I'd do is to find the rows where you have two blobs, instead of 0 or 1. Then for those, log the left edge and the right edge. Then take the average of them after you've scanned every row. Let me know if you can't figure it out.
1 comentario
Más respuestas (1)
Angelo Yeo
el 22 de Nov. de 2023
Editada: Angelo Yeo
el 22 de Nov. de 2023
I didn't detect rectangulars, but would this work for you?
img_orig = imread('image.png');
img = imbinarize(img_orig);
[~,c] = find(img(:,:,1) == 1);
figure;
imshow(img_orig); hold on;
line(ones(1,2) * mean(c), [0, size(img,1)],'color','r', 'linewidth',2)
Ver también
Productos
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!
