Image Processing Edge Detection: Remove unwanted edges
15 次查看(过去 30 天)
显示 更早的评论
Firstly, apologies for the length of this question. But I feel it needs a little bit of an explanation so that my objective can be understood.
I want to detect only the edge that surrounds the subject of the image, but edge detection operators such as canny, sobel etc. (with varying thresholds) all yield too many edges (false positives for what I want to achieve)...
My workaround for this is to use segmentation to pick out only the subject of the image and the background, and I seem to have done this successfully. I have then run canny edge detection on this segmented version, which appears at first to give me the edge I want. However, after a deeper examination, these edges are off by sometimes up to 4 pixels because of the way the segmentation process worked. So I am wondering if there is now a way to use the segmented edge image to say "keep all edges within 5 pixels of this edge, and remove all the others"...
Can anyone tell me how I can do this?
0 个评论
回答(2 个)
Sean de Wolski
2011-4-15
Yes.
doc bwdist
on a logical image will return the distances to the edge. Then you can use a threshold (e.g D <=5) to expand it.
Ps. Your question was well written and we don't mind the length ;) However, as a forum, whenever an image processing related question is asked, it's strongly advised to post an image. You can see how do this by clicking on "Markup Help". We may be able to help you find a better way altogether.
-Sean
Sean de Wolski
2011-4-15
D = bwdist(canny_edge_detection); % Distance xform
M = full_edge_detection_image&(D<5); % Edges in the full edge image and within within 5 of the canny.
Could you post the original image too.
4 个评论
moahaimen talib
2017-3-6
hi i need pruning code for image can anyone answer me to send the full image
Rongsong Yang
2018-7-5
what do you mean "full_edge_detection_image&(D<5)"? It seems undefined in Matlab
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!