Class Objdetect
java.lang.Object
org.opencv.objdetect.Objdetect
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final intstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleancheckChessboard(Mat img, Size size) Checks whether the image contains chessboard of the specific size or not.static voiddrawChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners, boolean patternWasFound) Renders the detected chessboard corners.static voiddrawDetectedCornersCharuco(Mat image, Mat charucoCorners) Draws a set of Charuco cornersstatic voiddrawDetectedCornersCharuco(Mat image, Mat charucoCorners, Mat charucoIds) Draws a set of Charuco cornersstatic voiddrawDetectedCornersCharuco(Mat image, Mat charucoCorners, Mat charucoIds, Scalar cornerColor) Draws a set of Charuco cornersstatic voiddrawDetectedDiamonds(Mat image, List<Mat> diamondCorners) Draw a set of detected ChArUco Diamond markersstatic voiddrawDetectedDiamonds(Mat image, List<Mat> diamondCorners, Mat diamondIds) Draw a set of detected ChArUco Diamond markersstatic voidDraw a set of detected ChArUco Diamond markersstatic voiddrawDetectedMarkers(Mat image, List<Mat> corners) Draw detected markers in imagestatic voiddrawDetectedMarkers(Mat image, List<Mat> corners, Mat ids) Draw detected markers in imagestatic voidDraw detected markers in imagestatic ScalarestimateChessboardSharpness(Mat image, Size patternSize, Mat corners) Estimates the sharpness of a detected chessboard.static ScalarestimateChessboardSharpness(Mat image, Size patternSize, Mat corners, float rise_distance) Estimates the sharpness of a detected chessboard.static ScalarestimateChessboardSharpness(Mat image, Size patternSize, Mat corners, float rise_distance, boolean vertical) Estimates the sharpness of a detected chessboard.static ScalarestimateChessboardSharpness(Mat image, Size patternSize, Mat corners, float rise_distance, boolean vertical, Mat sharpness) Estimates the sharpness of a detected chessboard.static DictionaryextendDictionary(int nMarkers, int markerSize) Extend base dictionary by new nMarkersstatic DictionaryextendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary) Extend base dictionary by new nMarkersstatic DictionaryextendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary, int randomSeed) Extend base dictionary by new nMarkersstatic booleanfind4QuadCornerSubpix(Mat img, Mat corners, Size region_size) static booleanfindChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners) Finds the positions of internal corners of the chessboard.static booleanfindChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners, int flags) Finds the positions of internal corners of the chessboard.static booleanfindChessboardCornersSB(Mat image, Size patternSize, Mat corners) static booleanfindChessboardCornersSB(Mat image, Size patternSize, Mat corners, int flags) static booleanfindChessboardCornersSBWithMeta(Mat image, Size patternSize, Mat corners, int flags, Mat meta) Finds the positions of internal corners of the chessboard using a sector based approach.static booleanfindCirclesGrid(Mat image, Size patternSize, Mat centers) static booleanfindCirclesGrid(Mat image, Size patternSize, Mat centers, int flags) static voidgenerateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat img) Generate a canonical marker imagestatic voidgenerateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat img, int borderBits) Generate a canonical marker imagestatic DictionarygetPredefinedDictionary(int dict) Returns one of the predefined dictionaries referenced by DICT_*.
-
Field Details
-
CALIB_CB_ADAPTIVE_THRESH
public static final int CALIB_CB_ADAPTIVE_THRESH- See Also:
-
CALIB_CB_NORMALIZE_IMAGE
public static final int CALIB_CB_NORMALIZE_IMAGE- See Also:
-
CALIB_CB_FILTER_QUADS
public static final int CALIB_CB_FILTER_QUADS- See Also:
-
CALIB_CB_FAST_CHECK
public static final int CALIB_CB_FAST_CHECK- See Also:
-
CALIB_CB_EXHAUSTIVE
public static final int CALIB_CB_EXHAUSTIVE- See Also:
-
CALIB_CB_ACCURACY
public static final int CALIB_CB_ACCURACY- See Also:
-
CALIB_CB_LARGER
public static final int CALIB_CB_LARGER- See Also:
-
CALIB_CB_MARKER
public static final int CALIB_CB_MARKER- See Also:
-
CALIB_CB_PLAIN
public static final int CALIB_CB_PLAIN- See Also:
-
CALIB_CB_SYMMETRIC_GRID
public static final int CALIB_CB_SYMMETRIC_GRID- See Also:
-
CALIB_CB_ASYMMETRIC_GRID
public static final int CALIB_CB_ASYMMETRIC_GRID- See Also:
-
CALIB_CB_CLUSTERING
public static final int CALIB_CB_CLUSTERING- See Also:
-
CORNER_REFINE_NONE
public static final int CORNER_REFINE_NONE- See Also:
-
CORNER_REFINE_SUBPIX
public static final int CORNER_REFINE_SUBPIX- See Also:
-
CORNER_REFINE_CONTOUR
public static final int CORNER_REFINE_CONTOUR- See Also:
-
CORNER_REFINE_APRILTAG
public static final int CORNER_REFINE_APRILTAG- See Also:
-
DICT_4X4_50
public static final int DICT_4X4_50- See Also:
-
DICT_4X4_100
public static final int DICT_4X4_100- See Also:
-
DICT_4X4_250
public static final int DICT_4X4_250- See Also:
-
DICT_4X4_1000
public static final int DICT_4X4_1000- See Also:
-
DICT_5X5_50
public static final int DICT_5X5_50- See Also:
-
DICT_5X5_100
public static final int DICT_5X5_100- See Also:
-
DICT_5X5_250
public static final int DICT_5X5_250- See Also:
-
DICT_5X5_1000
public static final int DICT_5X5_1000- See Also:
-
DICT_6X6_50
public static final int DICT_6X6_50- See Also:
-
DICT_6X6_100
public static final int DICT_6X6_100- See Also:
-
DICT_6X6_250
public static final int DICT_6X6_250- See Also:
-
DICT_6X6_1000
public static final int DICT_6X6_1000- See Also:
-
DICT_7X7_50
public static final int DICT_7X7_50- See Also:
-
DICT_7X7_100
public static final int DICT_7X7_100- See Also:
-
DICT_7X7_250
public static final int DICT_7X7_250- See Also:
-
DICT_7X7_1000
public static final int DICT_7X7_1000- See Also:
-
DICT_ARUCO_ORIGINAL
public static final int DICT_ARUCO_ORIGINAL- See Also:
-
DICT_APRILTAG_16h5
public static final int DICT_APRILTAG_16h5- See Also:
-
DICT_APRILTAG_25h9
public static final int DICT_APRILTAG_25h9- See Also:
-
DICT_APRILTAG_36h10
public static final int DICT_APRILTAG_36h10- See Also:
-
DICT_APRILTAG_36h11
public static final int DICT_APRILTAG_36h11- See Also:
-
DICT_ARUCO_MIP_36h12
public static final int DICT_ARUCO_MIP_36h12- See Also:
-
MCC24
public static final int MCC24- See Also:
-
SG140
public static final int SG140- See Also:
-
VINYL18
public static final int VINYL18- See Also:
-
-
Constructor Details
-
Objdetect
public Objdetect()
-
-
Method Details
-
findChessboardCorners
public static boolean findChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners, int flags) Finds the positions of internal corners of the chessboard.- Parameters:
image- Source chessboard view. It must be an 8-bit grayscale or color image.patternSize- Number of inner corners per a chessboard row and column ( patternSize = cv::Size(points_per_row,points_per_column) = cv::Size(columns,rows) ).corners- Output array of detected corners.flags- Various operation flags that can be zero or a combination of the following values:- REF: CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black and white, rather than a fixed threshold level (computed from the average image brightness).
- REF: CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before applying fixed or adaptive thresholding.
- REF: CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads extracted at the contour retrieval stage.
- REF: CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners, and shortcut the call if none is found. This can drastically speed up the call in the degenerate condition when no chessboard is observed.
- REF: CALIB_CB_PLAIN All other flags are ignored. The input image is taken as is. No image processing is done to improve to find the checkerboard. This has the effect of speeding up the execution of the function but could lead to not recognizing the checkerboard if the image is not previously binarized in the appropriate manner.
- Returns:
- True if all of the corners are found and 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 is a view of the chessboard pattern and
locate the internal chessboard corners. For example, a regular chessboard has 8 x 8 squares and
7 x 7 internal corners, that is, points where the black squares touch each other. The detected
coordinates are approximate, and to determine their positions more accurately, the function
calls #cornerSubPix. You also may use the function #cornerSubPix with different parameters if
returned coordinates are not accurate enough.
Sample usage of detecting and drawing chessboard corners: :
Size patternsize(8,6); //interior number of corners Mat gray = ....; //source image vector<Point2f> corners; //this will be filled by the detected corners //CALIB_CB_FAST_CHECK saves a lot of time on images //that do not contain any chessboard corners bool patternfound = findChessboardCorners(gray, patternsize, corners, CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE + CALIB_CB_FAST_CHECK); if(patternfound) cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1), TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1)); drawChessboardCorners(img, patternsize, Mat(corners), 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. Otherwise, if there is no border and the background is dark, the outer black squares cannot be segmented properly and so the square grouping and ordering algorithm fails. Use thegenerate_pattern.pyPython script (REF: tutorial_camera_calibration_pattern) to create the desired checkerboard pattern.
-
findChessboardCorners
Finds the positions of internal corners of the chessboard.- Parameters:
image- Source chessboard view. It must be an 8-bit grayscale or color image.patternSize- Number of inner corners per a chessboard row and column ( patternSize = cv::Size(points_per_row,points_per_column) = cv::Size(columns,rows) ).corners- Output array of detected corners.- REF: CALIB_CB_ADAPTIVE_THRESH Use adaptive thresholding to convert the image to black and white, rather than a fixed threshold level (computed from the average image brightness).
- REF: CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before applying fixed or adaptive thresholding.
- REF: CALIB_CB_FILTER_QUADS Use additional criteria (like contour area, perimeter, square-like shape) to filter out false quads extracted at the contour retrieval stage.
- REF: CALIB_CB_FAST_CHECK Run a fast check on the image that looks for chessboard corners, and shortcut the call if none is found. This can drastically speed up the call in the degenerate condition when no chessboard is observed.
- REF: CALIB_CB_PLAIN All other flags are ignored. The input image is taken as is. No image processing is done to improve to find the checkerboard. This has the effect of speeding up the execution of the function but could lead to not recognizing the checkerboard if the image is not previously binarized in the appropriate manner.
- Returns:
- True if all of the corners are found and 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 is a view of the chessboard pattern and
locate the internal chessboard corners. For example, a regular chessboard has 8 x 8 squares and
7 x 7 internal corners, that is, points where the black squares touch each other. The detected
coordinates are approximate, and to determine their positions more accurately, the function
calls #cornerSubPix. You also may use the function #cornerSubPix with different parameters if
returned coordinates are not accurate enough.
Sample usage of detecting and drawing chessboard corners: :
Size patternsize(8,6); //interior number of corners Mat gray = ....; //source image vector<Point2f> corners; //this will be filled by the detected corners //CALIB_CB_FAST_CHECK saves a lot of time on images //that do not contain any chessboard corners bool patternfound = findChessboardCorners(gray, patternsize, corners, CALIB_CB_ADAPTIVE_THRESH + CALIB_CB_NORMALIZE_IMAGE + CALIB_CB_FAST_CHECK); if(patternfound) cornerSubPix(gray, corners, Size(11, 11), Size(-1, -1), TermCriteria(CV_TERMCRIT_EPS + CV_TERMCRIT_ITER, 30, 0.1)); drawChessboardCorners(img, patternsize, Mat(corners), 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. Otherwise, if there is no border and the background is dark, the outer black squares cannot be segmented properly and so the square grouping and ordering algorithm fails. Use thegenerate_pattern.pyPython script (REF: tutorial_camera_calibration_pattern) to create the desired checkerboard pattern.
-
checkChessboard
-
findChessboardCornersSBWithMeta
public static boolean findChessboardCornersSBWithMeta(Mat image, Size patternSize, Mat corners, int flags, Mat meta) Finds the positions of internal corners of the chessboard using a sector based approach.- Parameters:
image- Source chessboard view. It must be an 8-bit grayscale or color image.patternSize- Number of inner corners per a chessboard row and column ( patternSize = cv::Size(points_per_row,points_per_column) = cv::Size(columns,rows) ).corners- Output array of detected corners.flags- Various operation flags that can be zero or a combination of the following values:- REF: CALIB_CB_NORMALIZE_IMAGE Normalize the image gamma with equalizeHist before detection.
- REF: CALIB_CB_EXHAUSTIVE Run an exhaustive search to improve detection rate.
- REF: CALIB_CB_ACCURACY Up sample input image to improve sub-pixel accuracy due to aliasing effects.
- REF: CALIB_CB_LARGER The detected pattern is allowed to be larger than patternSize (see description).
- REF: CALIB_CB_MARKER The detected pattern must have a marker (see description). This should be used if an accurate camera calibration is required.
meta- 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)
generate_pattern.pyPython script (REF: tutorial_camera_calibration_pattern) to create the corresponding checkerboard pattern: \image html pics/checkerboard_radon.png width=60%- Returns:
- automatically generated
-
findChessboardCornersSB
-
findChessboardCornersSB
-
estimateChessboardSharpness
public static Scalar estimateChessboardSharpness(Mat image, Size patternSize, Mat corners, float rise_distance, boolean vertical, Mat sharpness) Estimates the sharpness of a detected chessboard. Image sharpness, as well as brightness, are a critical parameter for accuracte camera calibration. For accessing these parameters for filtering out problematic calibraiton images, this method calculates edge profiles by traveling from black to white chessboard cell centers. Based on this, the number of pixels is calculated required to transit from black to white. This width of the transition area is a good indication of how sharp the chessboard is imaged and should be below ~3.0 pixels.- Parameters:
image- Gray image used to find chessboard cornerspatternSize- Size of a found chessboard patterncorners- Corners found by #findChessboardCornersSBrise_distance- Rise distance 0.8 means 10% ... 90% of the final signal strengthvertical- By default edge responses for horizontal lines are calculatedsharpness- Optional output array with a sharpness value for calculated edge responses (see description) The optional sharpness array is of type CV_32FC1 and has for each calculated profile one row with the following five entries: 0 = x coordinate of the underlying edge in the image 1 = y coordinate of the underlying edge in the image 2 = width of the transition area (sharpness) 3 = signal strength in the black cell (min brightness) 4 = signal strength in the white cell (max brightness)- Returns:
- Scalar(average sharpness, average min brightness, average max brightness,0)
-
estimateChessboardSharpness
public static Scalar estimateChessboardSharpness(Mat image, Size patternSize, Mat corners, float rise_distance, boolean vertical) Estimates the sharpness of a detected chessboard. Image sharpness, as well as brightness, are a critical parameter for accuracte camera calibration. For accessing these parameters for filtering out problematic calibraiton images, this method calculates edge profiles by traveling from black to white chessboard cell centers. Based on this, the number of pixels is calculated required to transit from black to white. This width of the transition area is a good indication of how sharp the chessboard is imaged and should be below ~3.0 pixels.- Parameters:
image- Gray image used to find chessboard cornerspatternSize- Size of a found chessboard patterncorners- Corners found by #findChessboardCornersSBrise_distance- Rise distance 0.8 means 10% ... 90% of the final signal strengthvertical- By default edge responses for horizontal lines are calculated The optional sharpness array is of type CV_32FC1 and has for each calculated profile one row with the following five entries: 0 = x coordinate of the underlying edge in the image 1 = y coordinate of the underlying edge in the image 2 = width of the transition area (sharpness) 3 = signal strength in the black cell (min brightness) 4 = signal strength in the white cell (max brightness)- Returns:
- Scalar(average sharpness, average min brightness, average max brightness,0)
-
estimateChessboardSharpness
public static Scalar estimateChessboardSharpness(Mat image, Size patternSize, Mat corners, float rise_distance) Estimates the sharpness of a detected chessboard. Image sharpness, as well as brightness, are a critical parameter for accuracte camera calibration. For accessing these parameters for filtering out problematic calibraiton images, this method calculates edge profiles by traveling from black to white chessboard cell centers. Based on this, the number of pixels is calculated required to transit from black to white. This width of the transition area is a good indication of how sharp the chessboard is imaged and should be below ~3.0 pixels.- Parameters:
image- Gray image used to find chessboard cornerspatternSize- Size of a found chessboard patterncorners- Corners found by #findChessboardCornersSBrise_distance- Rise distance 0.8 means 10% ... 90% of the final signal strength The optional sharpness array is of type CV_32FC1 and has for each calculated profile one row with the following five entries: 0 = x coordinate of the underlying edge in the image 1 = y coordinate of the underlying edge in the image 2 = width of the transition area (sharpness) 3 = signal strength in the black cell (min brightness) 4 = signal strength in the white cell (max brightness)- Returns:
- Scalar(average sharpness, average min brightness, average max brightness,0)
-
estimateChessboardSharpness
Estimates the sharpness of a detected chessboard. Image sharpness, as well as brightness, are a critical parameter for accuracte camera calibration. For accessing these parameters for filtering out problematic calibraiton images, this method calculates edge profiles by traveling from black to white chessboard cell centers. Based on this, the number of pixels is calculated required to transit from black to white. This width of the transition area is a good indication of how sharp the chessboard is imaged and should be below ~3.0 pixels.- Parameters:
image- Gray image used to find chessboard cornerspatternSize- Size of a found chessboard patterncorners- Corners found by #findChessboardCornersSB The optional sharpness array is of type CV_32FC1 and has for each calculated profile one row with the following five entries: 0 = x coordinate of the underlying edge in the image 1 = y coordinate of the underlying edge in the image 2 = width of the transition area (sharpness) 3 = signal strength in the black cell (min brightness) 4 = signal strength in the white cell (max brightness)- Returns:
- Scalar(average sharpness, average min brightness, average max brightness,0)
-
find4QuadCornerSubpix
-
drawChessboardCorners
public static void drawChessboardCorners(Mat image, Size patternSize, MatOfPoint2f corners, boolean patternWasFound) Renders the detected chessboard corners.- Parameters:
image- Destination image. It must be an 8-bit color image.patternSize- Number of inner corners per a chessboard row and column (patternSize = cv::Size(points_per_row,points_per_column)).corners- Array of detected corners, the output of #findChessboardCorners.patternWasFound- Parameter indicating whether the complete board was found or not. The return value of #findChessboardCorners should be passed here. The function draws individual chessboard corners detected either as red circles if the board was not found, or as colored corners connected with lines if the board was found.
-
findCirclesGrid
-
findCirclesGrid
-
drawDetectedCornersCharuco
public static void drawDetectedCornersCharuco(Mat image, Mat charucoCorners, Mat charucoIds, Scalar cornerColor) Draws a set of Charuco corners- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.charucoCorners- vector of detected charuco cornerscharucoIds- list of identifiers for each corner in charucoCornerscornerColor- color of the square surrounding each corner This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
-
drawDetectedCornersCharuco
Draws a set of Charuco corners- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.charucoCorners- vector of detected charuco cornerscharucoIds- list of identifiers for each corner in charucoCorners This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
-
drawDetectedCornersCharuco
Draws a set of Charuco corners- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.charucoCorners- vector of detected charuco corners This function draws a set of detected Charuco corners. If identifiers vector is provided, it also draws the id of each corner.
-
drawDetectedDiamonds
public static void drawDetectedDiamonds(Mat image, List<Mat> diamondCorners, Mat diamondIds, Scalar borderColor) Draw a set of detected ChArUco Diamond markers- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.diamondCorners- positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.diamondIds- vector of identifiers for diamonds in diamondCorners, in the same format returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted.borderColor- color of marker borders. Rest of colors (text color and first corner color) are calculated based on this one. Given an array of detected diamonds, this functions draws them in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
-
drawDetectedDiamonds
Draw a set of detected ChArUco Diamond markers- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.diamondCorners- positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.diamondIds- vector of identifiers for diamonds in diamondCorners, in the same format returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted. are calculated based on this one. Given an array of detected diamonds, this functions draws them in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
-
drawDetectedDiamonds
Draw a set of detected ChArUco Diamond markers- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.diamondCorners- positions of diamond corners in the same format returned by detectCharucoDiamond(). (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. returned by detectCharucoDiamond() (e.g. std::vector<Vec4i>). Optional, if not provided, ids are not painted. are calculated based on this one. Given an array of detected diamonds, this functions draws them in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
-
getPredefinedDictionary
Returns one of the predefined dictionaries referenced by DICT_*.- Parameters:
dict- automatically generated- Returns:
- automatically generated
-
extendDictionary
public static Dictionary extendDictionary(int nMarkers, int markerSize, Dictionary baseDictionary, int randomSeed) Extend base dictionary by new nMarkers- Parameters:
nMarkers- number of markers in the dictionarymarkerSize- number of bits per dimension of each markersbaseDictionary- Include the markers in this dictionary at the beginning (optional)randomSeed- a user supplied seed for theRNG() This function creates a new dictionary composed by nMarkers markers and each markers composed by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly included and the rest are generated based on them. If the size of baseDictionary is higher than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.- Returns:
- automatically generated
-
extendDictionary
Extend base dictionary by new nMarkers- Parameters:
nMarkers- number of markers in the dictionarymarkerSize- number of bits per dimension of each markersbaseDictionary- Include the markers in this dictionary at the beginning (optional) This function creates a new dictionary composed by nMarkers markers and each markers composed by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly included and the rest are generated based on them. If the size of baseDictionary is higher than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.- Returns:
- automatically generated
-
extendDictionary
Extend base dictionary by new nMarkers- Parameters:
nMarkers- number of markers in the dictionarymarkerSize- number of bits per dimension of each markers This function creates a new dictionary composed by nMarkers markers and each markers composed by markerSize x markerSize bits. If baseDictionary is provided, its markers are directly included and the rest are generated based on them. If the size of baseDictionary is higher than nMarkers, only the first nMarkers in baseDictionary are taken and no new marker is added.- Returns:
- automatically generated
-
drawDetectedMarkers
Draw detected markers in image- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.corners- positions of marker corners on input image. (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.ids- vector of identifiers for markers in markersCorners . Optional, if not provided, ids are not painted.borderColor- color of marker borders. Rest of colors (text color and first corner color) are calculated based on this one to improve visualization. Given an array of detected marker corners and its corresponding ids, this functions draws the markers in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
-
drawDetectedMarkers
Draw detected markers in image- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.corners- positions of marker corners on input image. (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise.ids- vector of identifiers for markers in markersCorners . Optional, if not provided, ids are not painted. are calculated based on this one to improve visualization. Given an array of detected marker corners and its corresponding ids, this functions draws the markers in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
-
drawDetectedMarkers
Draw detected markers in image- Parameters:
image- input/output image. It must have 1 or 3 channels. The number of channels is not altered.corners- positions of marker corners on input image. (e.g std::vector<std::vector<cv::Point2f> > ). For N detected markers, the dimensions of this array should be Nx4. The order of the corners should be clockwise. Optional, if not provided, ids are not painted. are calculated based on this one to improve visualization. Given an array of detected marker corners and its corresponding ids, this functions draws the markers in the image. The marker borders are painted and the markers identifiers if provided. Useful for debugging purposes.
-
generateImageMarker
public static void generateImageMarker(Dictionary dictionary, int id, int sidePixels, Mat img, int borderBits) Generate a canonical marker image- Parameters:
dictionary- dictionary of markers indicating the type of markersid- identifier of the marker that will be returned. It has to be a valid id in the specified dictionary.sidePixels- size of the image in pixelsimg- output image with the markerborderBits- width of the marker border. This function returns a marker image in its canonical form (i.e. ready to be printed)
-
generateImageMarker
Generate a canonical marker image- Parameters:
dictionary- dictionary of markers indicating the type of markersid- identifier of the marker that will be returned. It has to be a valid id in the specified dictionary.sidePixels- size of the image in pixelsimg- output image with the marker This function returns a marker image in its canonical form (i.e. ready to be printed)
-