Image Processing Edge Detection: Remove unwanted edges
45 views (last 30 days)
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?
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.
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.