MATLAB File Help: cv.findCirclesGrid | Index |
Finds the centers in the grid of circles
centers = cv.findCirclesGrid(im, patternSize)
[centers,patternFound] = cv.findCirclesGrid(im, patternSize)
[...] = cv.findCirclesGrid(..., 'OptionName', optionValue, ...)
patternSize = [points_per_row, points_per_colum]
).{[x,y], ...}
.{fdetector, 'key',val, ...}
,
where the first element is the type, and the remaining elements are
optional parameters used to construct the specified feature detector.
See cv.FeatureDetector for possible types.
default is to use cv.SimpleBlobDetector with its default parameters.The function attempts to determine whether the input image contains a grid
of circles. If it is, the function locates centers of the circles. The
function returns true
if all of the centers have been found and they have
been placed in a certain order (row by row, left to right in every row).
Otherwise, if the function fails to find all the corners or reorder them,
it returns false
.
Sample usage of detecting and drawing the centers of circles:
patternSize = [7,7]; % number of centers
gray = imread('...'); % source 8-bit image
[centers,patternfound] = cv.findCirclesGrid(gray, patternSize);
img = cv.drawChessboardCorners(img, patternSize, cat(1,centers{:}), ...
'PatternWasFound',patternfound);
imshow(img)
The function requires white space (like a square-thick border, the wider the better) around the board to make the detection more robust in various environments.