Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
See more: C++ ImageProcessing , +
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 31-May-12 20:16pm
Pixel86310
Edited 1-Jun-12 1:22am
v5
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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[^]
  Permalink  
Comments
Pixel86 at 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 at 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 at 2-Jun-12 14:03pm
   
The only problem is that Hough Transform might not work on distorted circles or not perfectly circular object.
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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.
  Permalink  

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

  Print Answers RSS
0 Sergey Alexandrovich Kryukov 575
1 Kornfeld Eliyahu Peter 409
2 Maciej Los 369
3 DamithSL 196
4 OriginalGriff 188
0 OriginalGriff 6,353
1 DamithSL 4,854
2 Maciej Los 4,476
3 Kornfeld Eliyahu Peter 4,058
4 Sergey Alexandrovich Kryukov 3,917


Advertise | Privacy | Mobile
Web01 | 2.8.141223.1 | Last Updated 1 Jun 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100