Make a continuous line from an edge
7 visualizaciones (últimos 30 días)
Mostrar comentarios más antiguos
Francesco Pignatelli
el 26 de Jul. de 2022
Comentada: Francesco Pignatelli
el 26 de Jul. de 2022
Hello all,
I am trying to extract the edge from a picture. However the resulting edge is disconnected and I do not know how to each single segment I have, making a continuous line. I am usign the following code:
image=load('imagePLIF.mat');
image=image.image;
imageB=image(:,170:1232);
BW = medfilt2(imageB,[5,5]);
BW = mat2gray(BW);
imagesc(BW)
BWmean = rescale(BW);
PLIF_gaussfilt = imguidedfilter(imgaussfilt(BWmean));
PLIF_sharpen = imsharpen(PLIF_gaussfilt, 'Radius', 1, 'Amount', 1);
PLIF_sharpen(PLIF_sharpen > .12) = 1;
PLIF_edge = edge(PLIF_sharpen, 'Sobel');
figure()
imagesc(PLIF_edge)
0 comentarios
Respuesta aceptada
sudobash
el 26 de Jul. de 2022
Hey there!
So, as per my understanding, you want to make the edges continuous. I ran your code and found that it actually is giving the output as a single continuous line. When looking at the scaled down version, it looks as if the line is not continuous. Try opening the image in a window.
If you would like to have the line a bit more thicker, try using the 'nothining' option in sobel filter like this:
PLIF_edge = edge(PLIF_sharpen, 'Sobel','nothinning');
This gives thicker lines. I hope this answer helps solve your issue.
3 comentarios
Image Analyst
el 26 de Jul. de 2022
Run bwskel after that. I would have thought edge() would do that internally and if it did, it shouldn't breaks the lines, but you say it did, so go figure. Anyway, I'd try bwskel() after the thick edge call and hopefully that won't break the lines. Otherwise if it does we need to do what I said in your comment in the other question - get the edges another way, like via thresholding and bwboundaries. However you didn't attach your original image here like I asked over there.
Más respuestas (0)
Ver también
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!