detectBarnes: Detect Circles in a Maze Image

View source: R/detectBarnes.R

detectBarnesR Documentation

Detect Circles in a Maze Image

Description

The function first applies the Canny edge detection algorithm to the input image. It then detects circles corresponding to the board and holes using the detectCircles function. The function filters the detected hole circles based on their distance from the board circle, ensuring they fall within acceptable ranges relative to the specified radii. Finally, it calculates the median radius and angle differences of the remaining circles and constructs a circular representation for the holes based on these parameters.

Usage

detectBarnes(im, boardRadius, holeRadius, sigma = 25, plot = TRUE)

Arguments

im

A matrix representing the image where the circles will be detected.

boardRadius

The expected radius of the board circles.

holeRadius

The expected radius of the hole circles.

sigma

An optional parameter that controls the standard deviation for the Gaussian filter used in edge detection (default value is 25).

plot

Opcion of plot

Details

Detects circles representing boards and holes in a given image of a maze. It utilizes edge detection to identify potential circle patterns based on specified radius parameters. The function returns the detected circles' coordinates, along with additional information about the board and hole radii.

Value

A list containing:

c1

Coordinates of the detected board circle.

boardRadius

Radius of the board circle.

c2

A list of coordinates representing the detected hole circles.

holeRadius

Radius of the hole circles.

Examples

path <- system.file('extdata/data.tiff', package='BioTrajectory')
im <- tiff::readTIFF(path)
im <- imager::as.cimg(t(im[,,1]))
Barnes <- detectBarnes(im, boardRadius=207, holeRadius=13, sigma=25)

BioTrajectory documentation built on June 8, 2025, 11:54 a.m.