1. Home
  2. Docs
  3. Computer Vision
  4. Object Detection
  5. Grid Detection

Grid Detection

Grid detection, specifically chessboard pattern detection, is primarily used in camera calibration to correct distortions and improve the accuracy of images captured by cameras.

  • findChessboardCorners()
  • drawChessboardCorners()
  • findCirclesGrid()

findChessboardCorners( )

Function in OpenCV is used to detect the internal corners of a chessboard pattern in an image.

cv2.findChessboardCorners(image, patternSize[, corners[, flags]])
  • image: The input image where the chessboard pattern is to be found. It should be a grayscale image.
  • patternSize: The number of inner corners per chessboard row and column (e.g., (8, 5) for a 9×6 board).
  • corners: Output array of detected corners.
  • flags: Various operation flags such as cv2.CALIB_CB_ADAPTIVE_THRESH, cv2.CALIB_CB_NORMALIZE_IMAGE, etc.

drawChessboardCorners()

drawChessboardCorners() is a function in OpenCV that draws detected corners on a chessboard pattern image.

It is typically used after detecting the chessboard corners using cv2.findChessboardCorners().

cv2.drawChessboardCorners(image, patternSize, corners, patternWasFound)
  • image: The input image on which the corners need to be drawn.
  • patternSize: The number of inside corners in the chessboard pattern (columns, rows).
  • corners: The array of detected corners returned by cv2.findChessboardCorners().
  • patternWasFound: A boolean indicating whether the chessboard pattern was found (True) or not (False). If False, no corners will be drawn.

cv2.findCirclesGrid()

ucv2.findCirclesGrid() is an OpenCV function used to detect circular grid patterns, typically for camera calibration purposes.

found, corners = cv2.findCirclesGrid(image, patternSize, flags=cv2.CALIB_CB_SYMMETRIC_GRID)
  • image: The input image where the grid pattern is located.
  • patternSize: A tuple representing the number of circles in rows and columns of the grid (e.g., (10,10)).
  • flags: A set of options for how the function should operate.
  •  For circle grids, this can include flags like:cv2.CALIB_CB_SYMMETRIC_GRID: For a symmetric grid where circles are aligned regularly in rows and columns.
  • cv2.CALIB_CB_ASYMMETRIC_GRID: For an asymmetric grid where rows are staggered.

Loading

Views: 2

How can we help?

0 0 votes
Article Rating
Subscribe
Notify of
guest


0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments