circle.hough | R Documentation |
Uses a portion of the canny algorithm to find candidate edge points and the direction of the gradient at those points, then uses Hough Circle Transform to estimate circle parameters.
circle.hough(
im,
fw = 2,
qt = 0.995,
excl = 5,
rmin = min(dim(im))/4,
rmax = min(dim(im))/2,
rstep = 1,
dtheta_max = 0.5,
dtheta_step = 0.05,
nn = 7,
plots = TRUE,
details = FALSE
)
im |
The image to find a circle in (a modulation estimate is best) |
fw |
Size of Gaussian blur to smooth image |
qt |
Threshold to accept strong edge candidate |
excl |
Number of pixels to exclude around edge of frame as candidates |
rmin |
Minimum circle radius |
rmax |
Maximum circle radius |
rstep |
step size in constructing lookup table |
dtheta_max |
maximum assumed error in gradient direction |
dtheta_step |
increment for dtheta |
plots |
plot? |
details |
Return extra details? |
number |
of nearest neighbors for alternate calculation |
The Hough transform section first creates a lookup table of candidate radii and center points, then for each candidate edge point calculates potential centers along a fan of rays near the gradient direction. An inner join then finds matches in the lookup table and increments an accumulator vector. Highest vote at the end wins.
If details is FALSE a named list with the circle parameters
This is experimental and can be very slow. A good guess for the radius is very helpful.
Experimental feature: find the nn nearest neighbors of the selected trio of parameters
and calculate a vote weighted mean. This is returned as rxy_alt
if details is TRUE.
circle.pars()
, pupil.pars()
example("psifit", package="zernike", ask=FALSE)
X11()
cp2 <- circle.hough(tfit$mod, rmin=round(tfit$cp$rx)-10, rmax=round(tfit$cp$rx)+10)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.