Make a continuous line from an edge
조회 수: 5 (최근 30일)
이전 댓글 표시
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
채택된 답변
sudobash
2022년 7월 26일
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
Image Analyst
2022년 7월 26일
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.
추가 답변 (0개)
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!