3
votes

I am using canny edge detector to detect edges from the input image.

In every input image, there can be two objects (main object and another object inside it) as shown in the sample image. Therefore, I am supposed to detect two edges in such scenarios

enter image description here

I determine the upper and lower thresholds automatically from the input image (using median and sigma). Most of the time canny works well but sometimes when the contrast of the image is not very good then edge detection fail as shown in following examples (NOTE:- outer edge is always detected correctly problem occurs with the inner edge)

enter image description here enter image description here

Canny detected the edge for the outer boundary but failed for the inner object. At the moment, I am using openCV with python. Is there any way I can improve the results of canny edge detection

Any help will be really appreciated

1
As you recognized, the problem stems from the relative lack of contrast. With Canny edge detector, which requires threshold parameters, you are always going to have this kind of issues. Try MSER: it may help in segmenting the two regions (requires some tuning too), but should be more robust for this type of image.Cyb3rFly3r
Have tried MSER with tuning but it also fails on these imagesuser1388142
Another approach could be to use Canny and then implement RANSAC with ellipse fitting to the broken edge.Cyb3rFly3r
problem is sometimes it does not detect the edge at all then ellipse fitting is not going to work ... I am looking for a way to somehow detect those unidentified edges if possibleuser1388142
Can you provide the raw data of images where it is not working, without any coloured edges?tfv

1 Answers

1
votes

Canny might be not the best tool here, but just a though: Have you tried histogram equalization? It will improve the contrast, so chances are Canny will work better.