[][src]Function opencv::calib3d::find_circles_grid

pub fn find_circles_grid(
    image: &dyn ToInputArray,
    pattern_size: Size,
    centers: &mut dyn ToOutputArray,
    flags: i32,
    blob_detector: &PtrOfFeature2D
) -> Result<bool>

Finds centers in the grid of circles.

Parameters

  • 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_colum) ).
  • centers: 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.
  • parameters: struct for finding circles in a grid pattern.

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 a non-zero value 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 0.

Sample usage of detecting and drawing the centers of circles: :

This example is not tested
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.

Overloaded parameters

C++ default parameters

  • flags: CALIB_CB_SYMMETRIC_GRID
  • blob_detector: SimpleBlobDetector::create()