All,
Does anyone know of an analytic rather than algorithmic definition for the circumference of a digital circle in pixels? David Webster -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
all pixels (x,y) are on the circumference for which
(x-x0)^2+ (y-y0)^2 = r^2 where x0,y0 is the center and r the radius. is this what you needed? On Wed, Jun 27, 2012 at 3:45 AM, David Webster <[hidden email]>wrote: > All, > > Does anyone know of an analytic rather than algorithmic definition for the > circumference of a digital circle in pixels? > > David Webster > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
On Wednesday 27 Jun 2012 12:47:21 Christian Tischer wrote:
> all pixels (x,y) are on the circumference for which > > (x-x0)^2+ (y-y0)^2 = r^2 > > where x0,y0 is the center and r the radius. According to this reference, the above does not strictly hold for digitised circles: http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.86.6622&rep=rep1&type=pdf Something interesting but not sure it is strictly related: you can't get a circularity of 1.0 in discrete 2D via the circularity formula, even with large circles, where it would expected they approach ideal circles better - due to the relative smaller spacing between pixels. The discrepancy between the circularity of digitised and ideal circles is not trivial: you can't get values larger than about 0.9 even with circles of 1000 pixel diameter. Cheers Gabriel -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by David Webster
Hi David,
it depends whether you trace the circle as 4-connected or 8-connected line. For a 4-connected circle, you can imagine moving all pixels outwards, towards the circumscribed square. The diagonals are the borders between pixels that you move horizontally or vertically. So the number of pixels in the traced line will be roughly 2*d*sqrt2. With a bit of care, one could probably find out the exact rounding rules. For an 8-connected line, one gets 4*(d-1) pixels. This is an exact result: starting at the diagonal directions, first take one pixel protruding to the inner side and flip it outwards. Then take 'L'-shaped parts (pointing outwards) and shift them outwards diagonally by sqrt2. You will eventually get a square by just moving the pixels. In both cases, 'd' is the size of the square enclosing all the pixels. If you draw a circle in ImageJ, it gives you d-1 as a width and height. Does this answer your question? Michael ________________________________________________________________ On Jun 27, 2012, at 03:45, David Webster wrote: > All, > > Does anyone know of an analytic rather than algorithmic definition for the > circumference of a digital circle in pixels? > > David Webster -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Gabriel Landini
Since you will get an approximation in any case why not minimize the
computation time by using Dx = Xmax - Xmin, D = (Dx + Dy)/2, or D = min(Dx, Dy)? On Wed, Jun 27, 2012 at 5:25 AM, Gabriel Landini <[hidden email]>wrote: > On Wednesday 27 Jun 2012 12:47:21 Christian Tischer wrote: > > all pixels (x,y) are on the circumference for which > > > > (x-x0)^2+ (y-y0)^2 = r^2 > > > > where x0,y0 is the center and r the radius. > > According to this reference, the above does not strictly hold for digitised > circles: > > > http://citeseerx.ist.psu.edu/viewdoc/download?doi=10.1.1.86.6622&rep=rep1&type=pdf > > Something interesting but not sure it is strictly related: you can't get a > circularity of 1.0 in discrete 2D via the circularity formula, even with > large > circles, where it would expected they approach ideal circles better - due > to > the relative smaller spacing between pixels. The discrepancy between the > circularity of digitised and ideal circles is not trivial: you can't get > values larger than about 0.9 even with circles of 1000 pixel diameter. > > Cheers > > Gabriel > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- When I was 12 I thought I would live forever. So far, so good. -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
In reply to this post by Michael Schmid
Thanx To All,
Michael's equations gave me what I needed. To clarify, by "analytic" I meant an equation or formula rather than an algorithmic procedure or series of steps. David On Wed, Jun 27, 2012 at 6:48 AM, Michael Schmid <[hidden email]>wrote: > Hi David, > > it depends whether you trace the circle as 4-connected or 8-connected line. > For a 4-connected circle, you can imagine moving all pixels outwards, > towards the circumscribed square. The diagonals are the borders between > pixels that you move horizontally or vertically. > > So the number of pixels in the traced line will be roughly 2*d*sqrt2. > With a bit of care, one could probably find out the exact rounding rules. > > For an 8-connected line, one gets 4*(d-1) pixels. > This is an exact result: starting at the diagonal directions, first take > one pixel protruding to the inner side and flip it outwards. Then take > 'L'-shaped parts (pointing outwards) and shift them outwards diagonally by > sqrt2. You will eventually get a square by just moving the pixels. > > In both cases, 'd' is the size of the square enclosing all the pixels. > If you draw a circle in ImageJ, it gives you d-1 as a width and height. > > > Does this answer your question? > > Michael > ________________________________________________________________ > On Jun 27, 2012, at 03:45, David Webster wrote: > > > All, > > > > Does anyone know of an analytic rather than algorithmic definition for > the > > circumference of a digital circle in pixels? > > > > David Webster > > -- > ImageJ mailing list: http://imagej.nih.gov/ij/list.html > -- ImageJ mailing list: http://imagej.nih.gov/ij/list.html |
Free forum by Nabble | Edit this page |