Click here to Skip to main content
15,881,581 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Finding circle's edges:

Here are the two sample images I have posted and I need an algorithm to find the edges of these circles. Is it possible to develop one generic circle algorithm, that could find all possible circles in all scenarios like the ones below?

  1. Circle may in different color ( White , Black , Gray , Red)
  2. Background color may be different
  3. Different in its size


Image 1:
http://postimage.org/image/tddhvs8c5/[^]
Image 2:
http://postimage.org/image/8kdxqiiyb/[^]
Image 3:
http://postimage.org/image/yuv4a30ch/[^]
Image 4:
http://postimage.org/image/5s4hbkqyb/[^]


Please suggest some idea to write an algorithm that should work out on above circles.

Thanks in advance!
Posted
Updated 1-Jun-12 0:22am
v5

A couple of things spring to mind for such a task.
  • Create a copy of the image and convert to grey-scale
  • Run an edge-detect filter on it (this will highlight the differences in contrast at feature boundaries
  • I vaguely recall reading of an adaption to the Hough transform that allows circles to be detected, rather than the most common straight-line


Yup, Circular Hough Transform appears to be the way to go. Plug that into google, make a pot of coffee and let the 'fun' and games begin!

Hough Transform Circles[^]
 
Share this answer
 
Comments
Pixel86 1-Jun-12 2:26am    
Hello enhzflep, The input image itself is 8 bit gray scale image and if i want to detect edge i need more contrast edges ( i enhanced the image ( Histogram equalization ) but the image still looks weird - even we could not see in our human eye )
Here you can find my enhanced images :
http://postimage.org/image/yuv4a30ch/

http://postimage.org/image/5s4hbkqyb/
enhzflep 1-Jun-12 6:37am    
Sorry, must've drifted off for a snooze! I'm not so sure that Histogram equalization will be needed - heck! You may-well not even need anything apart from the Circular Hough Transform itself.

Here's the kind of thing I mean by edge detection filter:
http://www.jasonokane.com/tu/351cos/sobel/

And an example of an interactive circular transform applet:
http://www.markschulze.net/java/hough/

Perhaps OpenCV has something that would do the trick. Don't know, never used it.
BupeChombaDerrick 2-Jun-12 14:03pm    
The only problem is that Hough Transform might not work on distorted circles or not perfectly circular object.
This requires some more preprocessing steps. Not easy to describe in a quick answer. it is more like a full image processing project. What you have to do in my opinion is:

* apply a pepper and salt filter to get rid of the structure (median filter)

* apply a 2D edge finder (Canny for example)

* either go with a Hough Transform (possibly it will deliver better results if you can put in some assumption about the radius of the cirles)

* or assume an approximate circle location, apply radial 1D edge finders from there and apply a common circle finder algorithm to calculate the exact center

None of these steps are really trivial and it takes quite a bit of image processing know-how to solve that problem. Sorry, if that discourages you.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900