[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

*Subject*: Re: Determining circularity*From*: Craig Markwardt <craigmnet(at)cow.physics.wisc.edu>*Date*: 25 May 2001 21:04:24 -0500*Newsgroups*: comp.lang.idl-pvwave*Organization*: U. Wisc. Madison Physics -- Compact Objects*References*: <mole6e23-CBD41D.15044725052001@news1.ucsd.edu>*Reply-To*: craigmnet(at)cow.physics.wisc.edu*Xref*: news.doit.wisc.edu comp.lang.idl-pvwave:25106

Todd Clements <mole6e23@hotmail.com> writes: > Hi all... > > I was wondering if anyone knew of routines to determine the circularity > of an image. We have images from our detector and for optimal > calibration, they need to be as circular as possible, and it's difficult > to tell by eye when it's close but not quite there. > > Generally these images have fairly well defined edges, although there is > definitely some gray area as to what consistutes the edge, which makes > it difficult to determine by eye sometimes. > > Basically, I guess it comes down to fitting the edge of the image to an > ellipse, but there has to be some determination of what the edge is as > well. Possible solution: 1. Edge filter with ROBERTSON (or perhaps SOBEL) 2. Extract X- and Y-position of edge points (use a threshold) 3. Fit to an ellipse using MPFITELLIPSE The last one is from my web page, and can be used for fitting an ellipse to a set of scattered points. It's not theoretically perfect but is good for rough calcs. Of course you need MPFIT as well. Here is a sample go-round. First I construct some fake data and then perform the steps above. ;; Construct a filled circle with a radius of 6 x = findgen(101)*0.2 - 10. & y = x xx = x # (y *0 + 1) ;; Construct X, Y, and R (radius) values yy = (x*0+1) # y rr = sqrt(xx^2 + yy^2) wh = where(rr LT 6.) ;; Fill the circle im = xx*0 im(wh) = 1 ;; Step 1. Extract edge-filtered image edge = roberts(im) ;; Step 2. Extract edge points using threshold value (value of 2 here) wh = where(edge EQ 2) xim = xx(wh) & yim = yy(wh) ;; Step 3. Fit the image print, mpfitellipse(xim, yim) ... results are ... 5.96942 5.96942 -0.100046 -0.100019 0.00000 XSEMI YSEMI XCENTER YCENTER ROTATION = 0 I make it look easy. The real trick is to find the right threshold to select the points from the data, and filtering out any other noise which will surely screw up the edge enhancement. Craig -------------------------------------------------------------------------- Craig B. Markwardt, Ph.D. EMAIL: craigmnet@cow.physics.wisc.edu Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response --------------------------------------------------------------------------

**Follow-Ups**:**Re: Determining circularity***From:*Craig Markwardt

**Re: Determining circularity***From:*Vince Hradil

**References**:**Determining circularity***From:*Todd Clements

- Prev by Date:
**Sorting and image rescaling** - Next by Date:
**Re: Convert Integer to Text** - Prev by thread:
**Determining circularity** - Next by thread:
**Re: Determining circularity** - Index(es):