Operator Reference

create_caltabcreate_caltabCreateCaltabCreateCaltabcreate_caltab (Operator)

create_caltabcreate_caltabCreateCaltabCreateCaltabcreate_caltab — Generate a calibration plate description file and a corresponding PostScript file for a calibration plate with hexagonally arranged marks.

Signature

Herror create_caltab(const Hlong NumRows, const Hlong MarksPerRow, double Diameter, const Hlong FinderRow, const Hlong FinderColumn, const char* Polarity, const char* CalPlateDescr, const char* CalPlatePSFile)

Herror T_create_caltab(const Htuple NumRows, const Htuple MarksPerRow, const Htuple Diameter, const Htuple FinderRow, const Htuple FinderColumn, const Htuple Polarity, const Htuple CalPlateDescr, const Htuple CalPlatePSFile)

void CreateCaltab(const HTuple& NumRows, const HTuple& MarksPerRow, const HTuple& Diameter, const HTuple& FinderRow, const HTuple& FinderColumn, const HTuple& Polarity, const HTuple& CalPlateDescr, const HTuple& CalPlatePSFile)

static void HMisc::CreateCaltab(Hlong NumRows, Hlong MarksPerRow, double Diameter, const HTuple& FinderRow, const HTuple& FinderColumn, const HString& Polarity, const HString& CalPlateDescr, const HString& CalPlatePSFile)

static void HMisc::CreateCaltab(Hlong NumRows, Hlong MarksPerRow, double Diameter, Hlong FinderRow, Hlong FinderColumn, const HString& Polarity, const HString& CalPlateDescr, const HString& CalPlatePSFile)

static void HMisc::CreateCaltab(Hlong NumRows, Hlong MarksPerRow, double Diameter, Hlong FinderRow, Hlong FinderColumn, const char* Polarity, const char* CalPlateDescr, const char* CalPlatePSFile)

static void HMisc::CreateCaltab(Hlong NumRows, Hlong MarksPerRow, double Diameter, Hlong FinderRow, Hlong FinderColumn, const wchar_t* Polarity, const wchar_t* CalPlateDescr, const wchar_t* CalPlatePSFile)   ( Windows only)

static void HOperatorSet.CreateCaltab(HTuple numRows, HTuple marksPerRow, HTuple diameter, HTuple finderRow, HTuple finderColumn, HTuple polarity, HTuple calPlateDescr, HTuple calPlatePSFile)

static void HMisc.CreateCaltab(int numRows, int marksPerRow, double diameter, HTuple finderRow, HTuple finderColumn, string polarity, string calPlateDescr, string calPlatePSFile)

static void HMisc.CreateCaltab(int numRows, int marksPerRow, double diameter, int finderRow, int finderColumn, string polarity, string calPlateDescr, string calPlatePSFile)

def create_caltab(num_rows: int, marks_per_row: int, diameter: float, finder_row: MaybeSequence[int], finder_column: MaybeSequence[int], polarity: str, cal_plate_descr: str, cal_plate_psfile: str) -> None

Description

create_caltabcreate_caltabCreateCaltabCreateCaltabcreate_caltab creates the description file of a standard HALCON calibration plate with hexagonally arranged marks. This calibration plate contains MarksPerRowMarksPerRowMarksPerRowmarksPerRowmarks_per_row times NumRowsNumRowsNumRowsnumRowsnum_rows circular marks. These marks are arranged in a hexagonal lattice such that each mark (except the ones at the border) has six equidistant neighbors.

image/svg+xml
A standard HALCON calibration plate with hexagonally arranged marks and its coordinate system.

The diameter of the marks is given by the parameter DiameterDiameterDiameterdiameterdiameter in meters. The distance between the centers of horizontally neighboring calibration marks is given by . The distance between neighboring rows of calibration marks is given by . The width and the height of the generated calibration plate can be calculated with the following equations:

The calibration plate contains one to five finder patterns. A finder pattern is a special mark hexagon (i.e. a mark and its six neighbors) where either four or six marks contain a hole. Each of these up to five finder patterns is unique such that it can be used to determine the orientation of the calibration plate and the position of the finder pattern on the calibration plate. As a consequence, the calibration plate can only be found by find_calib_objectfind_calib_objectFindCalibObjectFindCalibObjectfind_calib_object if at least one of these finder patterns is completely visible. The position of the central mark of each finder pattern is given in FinderRowFinderRowFinderRowfinderRowfinder_row and FinderColumnFinderColumnFinderColumnfinderColumnfinder_column. Thus, the length of the tuples given in FinderRowFinderRowFinderRowfinderRowfinder_row and FinderColumnFinderColumnFinderColumnfinderColumnfinder_column, respectively determine the number of finder patterns on the calibration plate. Be aware that two finder patterns must not overlap. It is recommended to keep a certain distance between the finder patterns, so every mark containing a hole can be assigned to a finder pattern distinctly. As a rule of thumb, if the calibration plate contains too few marks to place all finder patterns in distinct positions, it is better to reduce the number of finder patterns so that they can be distributed more evenly. An example case is depicted below, but note that a successful detection of the patterns also depends on the used camera setup.

The coordinate system of the calibration plate is located in the center of the central mark of the first finder pattern.

image/svg+xml
The finder patterns on a calibration plate should not be too close to each other (left). If there are not enough marks on your plate to distribute the finder patterns further apart you should reduce the number of finder patterns (right).

Depending on PolarityPolarityPolaritypolaritypolarity the marks are either light on dark background (for 'light_on_dark'"light_on_dark""light_on_dark""light_on_dark""light_on_dark", which is the default) or dark on light background (for 'dark_on_light'"dark_on_light""dark_on_light""dark_on_light""dark_on_light").

The file CalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr contains the calibration plate description, and must be passed to all HALCON operations using the generated calibration plate (e.g., set_calib_data_calib_objectset_calib_data_calib_objectSetCalibDataCalibObjectSetCalibDataCalibObjectset_calib_data_calib_object or sim_caltabsim_caltabSimCaltabSimCaltabsim_caltab). The default HALCON file extension for the description of a calibration plate with hexagonally arranged marks is 'cpd'.

A calibration plate description file contains information about:

  • the number of row and columns of the calibration plate

  • the number of marks per row and column

  • the offset of the coordinate system to the plate's surface in z-direction

  • the rim of the calibration plate

  • the polarity of the marks

  • the number and position of finder patterns

  • the x,y coordinates and radius of the calibration marks

A file generated by create_caltabcreate_caltabCreateCaltabCreateCaltabcreate_caltab looks like the following (comments are marked by a '#' at the beginning of a line):

# Plate Description Version 3
# HALCON Version 20.11 --  Wed Dec 16 11:02:00 2020
# Description of the standard calibration plate
# used for the camera calibration in HALCON
# (generated by create_caltab)
#
#

# 27 rows x 31 columns
# Width, height of calibration plate [meter]: 0.170323, 0.129118
# Distance between mark centers [meter]: 0.0051613

# Number of marks in y-dimension (rows)
r 27

# Number of marks in x-dimension (columns)
c 31

# offset of coordinate system in z-dimension [meter] (optional):
z 0

# rim of the calibration plate (min x, max y, max x, min y) [meter]:
o -0.083871125 0.0645592449151841 0.086451775 -0.0645592449151841

# polarity of the marks (light or dark):
p light

# number of finder pattern marks:
f 5

# position of the finder patterns (central mark):  x y [index]
15 13
6 6
24 6
6 20
24 20

# calibration marks:  x y radius [meter]

# calibration marks at y = -0.0581076 m
-0.07483885 -0.0581076199151841 0.001290325
-0.06967755 -0.0581076199151841 0.001290325
-0.06451625 -0.0581076199151841 0.001290325
-0.05935495 -0.0581076199151841 0.001290325
-0.05419365 -0.0581076199151841 0.001290325
-0.04903235 -0.0581076199151841 0.001290325
-0.04387105 -0.0581076199151841 0.001290325
-0.03870975 -0.0581076199151841 0.001290325
-0.03354845 -0.0581076199151841 0.001290325
-0.02838715 -0.0581076199151841 0.001290325
-0.02322585 -0.0581076199151841 0.001290325
-0.01806455 -0.0581076199151841 0.001290325
-0.01290325 -0.0581076199151841 0.001290325
-0.00774195 -0.0581076199151841 0.001290325
-0.00258065 -0.0581076199151841 0.001290325
0.00258065 -0.0581076199151841 0.001290325
0.00774195 -0.0581076199151841 0.001290325
0.01290325 -0.0581076199151841 0.001290325
0.01806455 -0.0581076199151841 0.001290325
0.02322585 -0.0581076199151841 0.001290325
0.02838715 -0.0581076199151841 0.001290325
0.03354845 -0.0581076199151841 0.001290325
0.03870975 -0.0581076199151841 0.001290325
0.04387105 -0.0581076199151841 0.001290325
0.04903235 -0.0581076199151841 0.001290325
0.05419365 -0.0581076199151841 0.001290325
0.05935495 -0.0581076199151841 0.001290325
0.06451625 -0.0581076199151841 0.001290325
0.06967755 -0.0581076199151841 0.001290325
0.07483885 -0.0581076199151841 0.001290325
0.08000015 -0.0581076199151841 0.001290325

# calibration marks at y = -0.0536378 m
-0.0774195 -0.0536378029986315 0.001290325
-0.0722582 -0.0536378029986315 0.001290325
-0.0670969 -0.0536378029986315 0.001290325
-0.0619356 -0.0536378029986315 0.001290325
-0.0567743 -0.0536378029986315 0.001290325
-0.051613 -0.0536378029986315 0.001290325
-0.0464517 -0.0536378029986315 0.001290325
-0.0412904 -0.0536378029986315 0.001290325
-0.0361291 -0.0536378029986315 0.001290325
-0.0309678 -0.0536378029986315 0.001290325
-0.0258065 -0.0536378029986315 0.001290325
-0.0206452 -0.0536378029986315 0.001290325
-0.0154839 -0.0536378029986315 0.001290325
-0.0103226 -0.0536378029986315 0.001290325
-0.0051613 -0.0536378029986315 0.001290325
0 -0.0536378029986315 0.001290325
0.0051613 -0.0536378029986315 0.001290325
0.0103226 -0.0536378029986315 0.001290325
0.0154839 -0.0536378029986315 0.001290325
0.0206452 -0.0536378029986315 0.001290325
0.0258065 -0.0536378029986315 0.001290325
0.0309678 -0.0536378029986315 0.001290325
0.0361291 -0.0536378029986315 0.001290325
0.0412904 -0.0536378029986315 0.001290325
0.0464517 -0.0536378029986315 0.001290325
0.051613 -0.0536378029986315 0.001290325
0.0567743 -0.0536378029986315 0.001290325
0.0619356 -0.0536378029986315 0.001290325
0.0670969 -0.0536378029986315 0.001290325
0.0722582 -0.0536378029986315 0.001290325
0.0774195 -0.0536378029986315 0.001290325

# calibration marks at y = -0.049168 m
...

# calibration marks at y = -0.0446982 m
...

# calibration marks at y = -0.0402284 m
...

# calibration marks at y = -0.0357585 m
...

# calibration marks at y = -0.0312887 m
...

# calibration marks at y = -0.0268189 m
...

# calibration marks at y = -0.0223491 m
...

# calibration marks at y = -0.0178793 m
...

# calibration marks at y = -0.0134095 m
...

# calibration marks at y = -0.00893963 m
...

# calibration marks at y = -0.00446982 m
...

# calibration marks at y = 0 m
...

# calibration marks at y = 0.00446982 m
...

# calibration marks at y = 0.00893963 m
...

# calibration marks at y = 0.0134095 m
...

# calibration marks at y = 0.0178793 m
...

# calibration marks at y = 0.0223491 m
...

# calibration marks at y = 0.0268189 m
...

# calibration marks at y = 0.0312887 m
...

# calibration marks at y = 0.0357585 m
...

# calibration marks at y = 0.0402284 m
...

# calibration marks at y = 0.0446982 m
...

# calibration marks at y = 0.049168 m
...

# calibration marks at y = 0.0536378 m
...

# calibration marks at y = 0.0581076 m
...

Note that only the coordinates and radius of the marks in the first two rows are listed completely. The corresponding coordinates and radius of the marks in the other rows are omitted for a better overview.

The file CalPlatePSFileCalPlatePSFileCalPlatePSFilecalPlatePSFilecal_plate_psfile contains the corresponding PostScript description of the calibration plate, which can be used to print the calibration plate.

Attention

Depending on the accuracy of the used output device (e.g., laser printer), a printed calibration plate may not match the values in the calibration plate description file CalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr exactly. Thus, the coordinates of the calibration marks in the calibration plate description file may have to be corrected!

For purchased calibration plates it is recommended to use the specific calibration description file that is supplied with your calibration plate.

Execution Information

  • Multithreading type: reentrant (runs in parallel with non-exclusive operators).
  • Multithreading scope: global (may be called from any thread).
  • Processed without parallelization.

Parameters

NumRowsNumRowsNumRowsnumRowsnum_rows (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of rows.

Default: 27

Recommended increment: 1

Restriction: NumRows > 2

MarksPerRowMarksPerRowMarksPerRowmarksPerRowmarks_per_row (input_control)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Number of marks per row.

Default: 31

Recommended increment: 1

Restriction: MarksPerRow > 2

DiameterDiameterDiameterdiameterdiameter (input_control)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

Diameter of the marks.

Default: 0.00258065

Suggested values: 0.00258065, 0.1, 0.0125, 0.00375, 0.00125

FinderRowFinderRowFinderRowfinderRowfinder_row (input_control)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Row indices of the finder patterns.

Default: [13,6,6,20,20]

FinderColumnFinderColumnFinderColumnfinderColumnfinder_column (input_control)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

Column indices of the finder patterns.

Default: [15,6,24,6,24]

PolarityPolarityPolaritypolaritypolarity (input_control)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

Polarity of the marks

Default: 'light_on_dark' "light_on_dark" "light_on_dark" "light_on_dark" "light_on_dark"

Suggested values: 'light_on_dark'"light_on_dark""light_on_dark""light_on_dark""light_on_dark", 'dark_on_light'"dark_on_light""dark_on_light""dark_on_light""dark_on_light"

CalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr (input_control)  filename.write HTuplestrHTupleHtuple (string) (string) (HString) (char*)

File name of the calibration plate description.

Default: 'calplate.cpd' "calplate.cpd" "calplate.cpd" "calplate.cpd" "calplate.cpd"

List of values: 'calplate.cpd'"calplate.cpd""calplate.cpd""calplate.cpd""calplate.cpd"

File extension: .cpd

CalPlatePSFileCalPlatePSFileCalPlatePSFilecalPlatePSFilecal_plate_psfile (input_control)  filename.write HTuplestrHTupleHtuple (string) (string) (HString) (char*)

File name of the PostScript file.

Default: 'calplate.ps' "calplate.ps" "calplate.ps" "calplate.ps" "calplate.ps"

File extension: .ps

Example (HDevelop)

* Parameters to create the descriptor for the 160mm wide calibration
* plate.
create_caltab (27, 31, 0.00258065, [13, 6, 6, 20, 20], [15, 6, 24, 6, 24], \
              'light_on_dark', 'calplate.cpd', 'caltab.ps')

Result

create_caltabcreate_caltabCreateCaltabCreateCaltabcreate_caltab returns 2 ( H_MSG_TRUE) if all parameter values are correct and both files have been written successfully. If necessary, an exception is raised.

Possible Successors

read_cam_parread_cam_parReadCamParReadCamParread_cam_par, caltab_pointscaltab_pointsCaltabPointsCaltabPointscaltab_points

Alternatives

gen_caltabgen_caltabGenCaltabGenCaltabgen_caltab

See also

find_caltabfind_caltabFindCaltabFindCaltabfind_caltab, find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationcamera_calibration, disp_caltabdisp_caltabDispCaltabDispCaltabdisp_caltab, sim_caltabsim_caltabSimCaltabSimCaltabsim_caltab

Module

Foundation