findChessboardCornersSBWithMeta
import { findChessboardCornersSBWithMeta } from '@banou/opencv-wasm'Use after await initOpenCV(). See the initialization and named imports guide.
Finds the positions of internal corners of the chessboard using a sector based approach.
Note: The function requires a white boarder with roughly the same width as one of the checkerboard fields around the whole board to improve the detection in various environments. In addition, because of the localized radon transformation it is beneficial to use round corners for the field corners which are located on the outside of the board. The following figure illustrates a sample checkerboard optimized for the detection. However, any other checkerboard can be used as well.
Use the generate_pattern.py Python script (tutorial_camera_calibration_pattern)
to create the corresponding checkerboard pattern:
\image html pics/checkerboard_radon.png width=60%
findChessboardCornersSBWithMeta(image: Mat, patternSize: Size, corners: Mat, flags: number, meta: Mat): boolean;imageSource chessboard view. It must be an 8-bit grayscale or color image.
patternSizeNumber of inner corners per a chessboard row and column ( patternSize = cv::Size(points_per_row,points_per_column) = cv::Size(columns,rows) ).
cornersOutput destination, filled by the native operation. Output array of detected corners.
flagsVarious operation flags that can be zero or a combination of the following values:
CALIB_CB_NORMALIZE_IMAGENormalize the image gamma with equalizeHist before detection.CALIB_CB_EXHAUSTIVERun an exhaustive search to improve detection rate.CALIB_CB_ACCURACYUp sample input image to improve sub-pixel accuracy due to aliasing effects.CALIB_CB_LARGERThe detected pattern is allowed to be larger than patternSize (see description).CALIB_CB_MARKERThe detected pattern must have a marker (see description). This should be used if an accurate camera calibration is required.
metaOutput destination, filled by the native operation. Optional output array of detected corners (CV_8UC1 and size = cv::Size(columns,rows)). Each entry stands for one corner of the pattern and can have one of the following values:
- 0 = no meta data attached
- 1 = left-top corner of a black cell
- 2 = left-top corner of a white cell
- 3 = left-top corner of a black cell with a white marker dot
- 4 = left-top corner of a white cell with a black marker dot (pattern origin in case of markers otherwise first corner)
The function is analog to #findChessboardCorners but uses a localized radon transformation approximated by box filters being more robust to all sort of noise, faster on larger images and is able to directly return the sub-pixel position of the internal chessboard corners. The Method is based on the paper [duda2018] "Accurate Detection and Localization of Checkerboard Corners for Calibration" demonstrating that the returned sub-pixel positions are more accurate than the one returned by cornerSubPix allowing a precise camera calibration for demanding applications.
In the case, the flags
CALIB_CB_LARGERorCALIB_CB_MARKERare given, the result can be recovered from the optional meta array. Both flags are helpful to use calibration patterns exceeding the field of view of the camera. These oversized patterns allow more accurate calibrations as corners can be utilized, which are as close as possible to the image borders. For a consistent coordinate system across all images, the optional marker (see image below) can be used to move the origin of the board to the location where the black circle is located.
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.