Click to See Complete Forum and Search --> : Looking for edge detection algorithm


xray_ravi
November 8th, 2010, 10:54 AM
I have an image of concentric rings of finite width projected on a 2 dimensional surface. Lets say the picture is read in an array of size N * N where N is number of pixels in X and Y direction. Is there an algorithm described somewhere that describes the easy detection of rings? The value of pixel within the ring width is assumed to be Gaussian. So the edge detection must know two sides of the band and then compute the center line within the width which is just a circle.



-Thanks
Ravi

answer
December 6th, 2010, 12:29 AM
I don't understand your problem very well.

You can do a variant of the hough transform for circles. It would be like this

r is the radius of the circle you want
foreach pixel x. y
sum = 0
foreach degree D from 0 to 2 PI
sum += pixelAt(x - r*sin(D), y - r*cos(D))
peak_image.setpixel(x, y, sum)

Now you have peaks, simply find the peaks and thats the centers of all your circles of radius r. repeat for each radius you want.

It would be better to provide a picture of what you are trying to process.

wladik
December 25th, 2010, 04:20 AM
Hi Ravi,

You can use the code from the open source project http://outliner.codeplex.com/ for your task. This code run natively with Microsoft Visual C++ on Windows computer. If you use other platforms or language, there will be a problem to adopt the Outliner algorithms.

The Outliner will put all the found contour dots into the collection of strokes:
std::deque<Stroke> mStrokes;

You will choose the sufficiently long strokes that are closed - these would be your circles.
The further processing require your own coding:
1. Choose three points on the selected stroke that are at sufficient distance from one another:
size_t n = mDots.size();
ConstDotIterator it = mDots.begin();
ContourDot& dot1 = *it;
std::advance(it, n/3);
ContourDot& dot2 = *it;
std::advance(it, n/3);
ContourDot& dot3 = *it;
2. Calculate the radius and center of the circle that passes through these three dots.
3. Make check that the other dots of the selected stroke will fit fine on your circle.

Wladik,
the author of the Otliner project.