circle.hough: Estimate parameters of a circle using Hough Circle Transform

View source: R/circle.hough.r

circle.houghR Documentation

Estimate parameters of a circle using Hough Circle Transform

Description

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.

Usage

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
)

Arguments

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

Details

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.

Value

If details is FALSE a named list with the circle parameters

Note

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.

See Also

circle.pars(), pupil.pars()

Examples

example("psifit", package="zernike", ask=FALSE)
X11()
cp2 <- circle.hough(tfit$mod, rmin=round(tfit$cp$rx)-10, rmax=round(tfit$cp$rx)+10)

mlpeck/zernike documentation built on April 19, 2024, 3:16 p.m.