findCirclesGrid
import { findCirclesGrid } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Finds centers in the grid of circles.
Size patternsize(7,7); //number of centers
Mat gray = ...; //source image
vector<Point2f> centers; //this will be filled by the detected centers
bool patternfound = findCirclesGrid(gray, patternsize, centers);
drawChessboardCorners(img, patternsize, Mat(centers), patternfound);
Note: 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.
findCirclesGrid(image: Mat, patternSize: Size, centers: Mat, flags: number, blobDetector: Feature2D | null, parameters: CirclesGridFinderParameters): boolean;imagegrid view of input circles; it must be an 8-bit grayscale or color image.
patternSizenumber of circles per row and column ( patternSize = Size(points_per_row, points_per_column) ).
centersOutput destination, filled by the native operation. output array of detected centers.
flagsvarious operation flags that can be one of the following values:
CALIB_CB_SYMMETRIC_GRIDuses symmetric pattern of circles.CALIB_CB_ASYMMETRIC_GRIDuses asymmetric pattern of circles.CALIB_CB_CLUSTERINGuses a special algorithm for grid detection. It is more robust to perspective distortions but much more sensitive to background clutter.
blobDetectorfeature detector that finds blobs like dark circles on light background. If
blobDetectoris NULL thenimagerepresents Point2f array of candidates.parametersstruct for finding circles in a grid pattern.
return 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.
The function attempts to determine whether the input image contains a grid of circles. If it is, the function locates centers of the circles.
Sample usage of detecting and drawing the centers of circles: :
The boolean result.
These signatures describe this package. Upstream documentation can mention optional backends that are absent from this build. Check runtime compatibility before choosing a backend or file format.