Main Content


Generate world coordinates for planar pattern keypoints

Since R2021b



worldPoints = generateWorldPoints(detectorObj) generates world coordinates for the detected keypoints of the calibration pattern.

worldPoints = generateWorldPoints(detectorObj,varargin) uses the varargin input to parse any additional parameters or options necessary to generate world points. For example, you can provide the parameters or options obtained from the properties pane of your calibrator app.


collapse all

Use this function template, which includes the use of the generateCheckerboardPoints object function, to generate world points for a checkerboard pattern generator. The function includes both programmatic and app workflows for generating the world (image) points. The function uses name-value arguments for board and square size to set the corresponding fields in the Properties pane of the calibrator app.

function worldPoints = generateWorldPoints(this,varargin) 
    if nargin > 1 % Command Line workflow
        parser = inputParser;
        boardSize = parser.Results.BoardSize;
        squareSize = parser.Results.SquareSize;
    else % Calibrator App workflow
        boardSize = this.BoardSize;
        squareSize = this.SquareSize;
    worldPoints = generateCheckerboardPoints(boardSize,squareSize);
    % Validation functions for command line workflow
    function tf = checkSquareSize(squareSize)
        validateattributes(squareSize, {'numeric'}, ...
        tf = true;
    function tf = checkBoardSize(boardSize)
            {'nonempty','vector','numel',2,'integer','positive','>=', 3},...
        tf = true;

Input Arguments

collapse all

Pattern detector, specified as a single or stereo vision.calibration.PatternDetector object.

Variable number of inputs, specified as a 1-by-N cell array, where N is the number of inputs to the function after detectorObj. For more details about using this input, see varargin.

Output Arguments

collapse all

Image coordinates of detected keypoints in the calibration pattern, returned as an M-by-2 array of x,y coordinates. M is the number of pattern keypoints detected in the calibration images by using thedetectPatternPoints function.

Version History

Introduced in R2021b