Skip to content

findCirclesGrid

objdetectfunctionOpenCV 5.0.0
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;
image

grid view of input circles; it must be an 8-bit grayscale or color image.

patternSize

number of circles per row and column ( patternSize = Size(points_per_row, points_per_column) ).

centers

Output destination, filled by the native operation. output array of detected centers.

flags

various operation flags that can be one of the following values:

  • CALIB_CB_SYMMETRIC_GRID uses symmetric pattern of circles.
  • CALIB_CB_ASYMMETRIC_GRID uses asymmetric pattern of circles.
  • CALIB_CB_CLUSTERING uses a special algorithm for grid detection. It is more robust to perspective distortions but much more sensitive to background clutter.
blobDetector

feature detector that finds blobs like dark circles on light background. If blobDetector is NULL then image represents Point2f array of candidates.

parameters

struct 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: :

Returns

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.