create_caltabcreate_caltabCreateCaltabCreateCaltabcreate_caltab创建标定表(算子)

名称

create_caltabcreate_caltabCreateCaltabCreateCaltabcreate_caltab — 为带有六边形排列标记的标定板生成标定板描述文件和相应的 PostScript 文件。

签名

create_caltab( : : NumRows, MarksPerRow, Diameter, FinderRow, FinderColumn, Polarity, CalPlateDescr, CalPlatePSFile : )

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

描述

create_caltabcreate_caltabCreateCaltabCreateCaltabCreateCaltabcreate_caltab 生成标准 HALCON 标定板的描述文件,该标定板采用六边形排列的标记。此标定板包含 MarksPerRowMarksPerRowMarksPerRowMarksPerRowmarksPerRowmarks_per_row 乘以 NumRowsNumRowsNumRowsNumRowsnumRowsnum_rows 的圆形标记。这些标记以六边形晶格排列,使得每个标记(边界处的标记除外)都有六个等距邻近的标记。

image/svg+xml
标准 HALCON 标定板,其标记呈六边形排列,并附带坐标系。

标记的直径由参数 DiameterDiameterDiameterDiameterdiameterdiameter(单位:米)决定。水平相邻标定标记中心间的距离为 。相邻标定标记行间的距离为 。生成的标定板宽度与高度可通过下列公式计算:

标定板包含一至五个查找器图案。查找器图案是一种特殊的标记六边形(即一个标记及其六个邻近标记),其中四个或六个标记包含孔洞。这最多五个查找器图案各不相同,可用于确定标定板的方位以及查找器图案在标定板上的位置。因此,只有当至少一个查找器图案完全可见时,find_calib_objectfind_calib_objectFindCalibObjectFindCalibObjectFindCalibObjectfind_calib_object 才能找到标定板。每个查找器图案的中心标记位置由 FinderRowFinderRowFinderRowFinderRowfinderRowfinder_rowFinderColumnFinderColumnFinderColumnFinderColumnfinderColumnfinder_column 给出。因此,FinderRowFinderRowFinderRowFinderRowfinderRowfinder_rowFinderColumnFinderColumnFinderColumnFinderColumnfinderColumnfinder_column 中给出的元组长度分别决定了标定板上查找器图案的数量。请注意,两个查找器图案不得重叠。建议在查找器图案间保持一定间距,确保每个含孔洞的标记均能明确对应特定查找器图案。经验法则是:若标定板标记数量不足以使所有查找器图案处于独立位置,则应减少图案数量以实现更均匀分布。下图展示典型案例,但需注意图案检测成功与否亦取决于相机配置参数。

标定板的坐标系位于首个查找器图案中心标记的中心位置。

image/svg+xml
标定板上的查找器图案间距不宜过密(左图)。若板面标记不足以使查找器图案间距增大,则应减少查找器图案数量(右图)。

根据 PolarityPolarityPolarityPolaritypolaritypolarity 设置,标记会呈现为深色背景上的浅色(默认值 'light_on_dark'"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""dark_on_light")。

文件 CalPlateDescrCalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr 包含标定板描述信息,必须传递给所有使用生成的标定板的 HALCON 操作(例如 set_calib_data_calib_objectset_calib_data_calib_objectSetCalibDataCalibObjectSetCalibDataCalibObjectSetCalibDataCalibObjectset_calib_data_calib_objectsim_caltabsim_caltabSimCaltabSimCaltabSimCaltabsim_caltab)。对于具有六边形排列标记的标定板描述,HALCON 默认文件扩展名为‘cpd’。

标定板描述文件包含以下信息:

create_caltabcreate_caltabCreateCaltabCreateCaltabCreateCaltabcreate_caltab 生成的文件如下所示(注释以行首的‘#’标记):

# 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 ...

请注意,仅完整列出了前两行标记的坐标和半径。为便于整体查看,其他行标记的对应坐标和半径均予以省略。

文件 CalPlatePSFileCalPlatePSFileCalPlatePSFileCalPlatePSFilecalPlatePSFilecal_plate_psfile 包含标定板的对应 PostScript 描述,可用于打印标定板。

注意

根据所用输出设备(如激光打印机)的精度,打印出的标定板可能与标定板描述文件 CalPlateDescrCalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr 中的数值不完全一致。因此,标定板描述文件中标定标记的坐标可能需要进行修正!

对于购买的标定板,建议使用随标定板提供的专用标定描述文件。

执行信息

参数

NumRowsNumRowsNumRowsNumRowsnumRowsnum_rows (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

行数。

默认值: 27

建议增量: 1

限制: NumRows > 2

MarksPerRowMarksPerRowMarksPerRowMarksPerRowmarksPerRowmarks_per_row (输入控制)  integer HTupleintHTupleHtuple (integer) (int / long) (Hlong) (Hlong)

每行标记数。

默认值: 31

建议增量: 1

限制: MarksPerRow > 2

DiameterDiameterDiameterDiameterdiameterdiameter (输入控制)  real HTuplefloatHTupleHtuple (real) (double) (double) (double)

标记的直径。

默认值: 0.00258065

建议值: 0.00258065, 0.1, 0.0125, 0.00375, 0.00125

FinderRowFinderRowFinderRowFinderRowfinderRowfinder_row (输入控制)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

查找器图案的行索引。

默认值: [13,6,6,20,20]

FinderColumnFinderColumnFinderColumnFinderColumnfinderColumnfinder_column (输入控制)  integer(-array) HTupleMaybeSequence[int]HTupleHtuple (integer) (int / long) (Hlong) (Hlong)

查找器图案的列索引。

默认值: [15,6,24,6,24]

PolarityPolarityPolarityPolaritypolaritypolarity (输入控制)  string HTuplestrHTupleHtuple (string) (string) (HString) (char*)

标记的极性。

默认值: 'light_on_dark' "light_on_dark" "light_on_dark" "light_on_dark" "light_on_dark" "light_on_dark"

建议值: 'light_on_dark'"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""dark_on_light"

CalPlateDescrCalPlateDescrCalPlateDescrCalPlateDescrcalPlateDescrcal_plate_descr (输入控制)  filename.write HTuplestrHTupleHtuple (string) (string) (HString) (char*)

标定板描述的文件名。

默认值: 'calplate.cpd' "calplate.cpd" "calplate.cpd" "calplate.cpd" "calplate.cpd" "calplate.cpd"

值列表: 'calplate.cpd'"calplate.cpd""calplate.cpd""calplate.cpd""calplate.cpd""calplate.cpd"

文件扩展名: .cpd

CalPlatePSFileCalPlatePSFileCalPlatePSFileCalPlatePSFilecalPlatePSFilecal_plate_psfile (输入控制)  filename.write HTuplestrHTupleHtuple (string) (string) (HString) (char*)

PostScript 文件的文件名。

默认值: 'calplate.ps' "calplate.ps" "calplate.ps" "calplate.ps" "calplate.ps" "calplate.ps"

文件扩展名: .ps

示例(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')

结果

create_caltabcreate_caltabCreateCaltabCreateCaltabCreateCaltabcreate_caltab 返回 2 (H_MSG_TRUE),当所有参数值正确且两个文件均已成功写入。如有必要,则抛出异常。

可能的后继

read_cam_parread_cam_parReadCamParReadCamParReadCamParread_cam_par, caltab_pointscaltab_pointsCaltabPointsCaltabPointsCaltabPointscaltab_points

替代

gen_caltabgen_caltabGenCaltabGenCaltabGenCaltabgen_caltab

另见

find_caltabfind_caltabFindCaltabFindCaltabFindCaltabfind_caltab, find_marks_and_posefind_marks_and_poseFindMarksAndPoseFindMarksAndPoseFindMarksAndPosefind_marks_and_pose, camera_calibrationcamera_calibrationCameraCalibrationCameraCalibrationCameraCalibrationcamera_calibration, disp_caltabdisp_caltabDispCaltabDispCaltabDispCaltabdisp_caltab, sim_caltabsim_caltabSimCaltabSimCaltabSimCaltabsim_caltab

模块

基础