create_sheet_of_light_modelT_create_sheet_of_light_modelCreateSheetOfLightModelCreateSheetOfLightModelcreate_sheet_of_light_model创建激光三角测量模型(算子)
名称
create_sheet_of_light_modelT_create_sheet_of_light_modelCreateSheetOfLightModelCreateSheetOfLightModelcreate_sheet_of_light_model — 使用激光三角测量技术创建模型以执行三维测量。
签名
void CreateSheetOfLightModel(const HObject& ProfileRegion, const HTuple& GenParamName, const HTuple& GenParamValue, HTuple* SheetOfLightModelID)
HSheetOfLightModel HRegion::CreateSheetOfLightModel(const HTuple& GenParamName, const HTuple& GenParamValue) const
HSheetOfLightModel HRegion::CreateSheetOfLightModel(const HString& GenParamName, Hlong GenParamValue) const
HSheetOfLightModel HRegion::CreateSheetOfLightModel(const char* GenParamName, Hlong GenParamValue) const
HSheetOfLightModel HRegion::CreateSheetOfLightModel(const wchar_t* GenParamName, Hlong GenParamValue) const
(
Windows only)
void HSheetOfLightModel::HSheetOfLightModel(const HRegion& ProfileRegion, const HTuple& GenParamName, const HTuple& GenParamValue)
void HSheetOfLightModel::HSheetOfLightModel(const HRegion& ProfileRegion, const HString& GenParamName, Hlong GenParamValue)
void HSheetOfLightModel::HSheetOfLightModel(const HRegion& ProfileRegion, const char* GenParamName, Hlong GenParamValue)
void HSheetOfLightModel::HSheetOfLightModel(const HRegion& ProfileRegion, const wchar_t* GenParamName, Hlong GenParamValue)
(
Windows only)
void HSheetOfLightModel::CreateSheetOfLightModel(const HRegion& ProfileRegion, const HTuple& GenParamName, const HTuple& GenParamValue)
void HSheetOfLightModel::CreateSheetOfLightModel(const HRegion& ProfileRegion, const HString& GenParamName, Hlong GenParamValue)
void HSheetOfLightModel::CreateSheetOfLightModel(const HRegion& ProfileRegion, const char* GenParamName, Hlong GenParamValue)
void HSheetOfLightModel::CreateSheetOfLightModel(const HRegion& ProfileRegion, const wchar_t* GenParamName, Hlong GenParamValue)
(
Windows only)
static void HOperatorSet.CreateSheetOfLightModel(HObject profileRegion, HTuple genParamName, HTuple genParamValue, out HTuple sheetOfLightModelID)
HSheetOfLightModel HRegion.CreateSheetOfLightModel(HTuple genParamName, HTuple genParamValue)
HSheetOfLightModel HRegion.CreateSheetOfLightModel(string genParamName, int genParamValue)
public HSheetOfLightModel(HRegion profileRegion, HTuple genParamName, HTuple genParamValue)
public HSheetOfLightModel(HRegion profileRegion, string genParamName, int genParamValue)
void HSheetOfLightModel.CreateSheetOfLightModel(HRegion profileRegion, HTuple genParamName, HTuple genParamValue)
void HSheetOfLightModel.CreateSheetOfLightModel(HRegion profileRegion, string genParamName, int genParamValue)
描述
算子 create_sheet_of_light_modelcreate_sheet_of_light_modelCreateSheetOfLightModelCreateSheetOfLightModelCreateSheetOfLightModelcreate_sheet_of_light_model 用于创建一个模型,以利用激光三角测量技术执行三维测量。
激光三角测量技术通过使用面阵扫描相机和光线投影仪(通常为激光线投影仪),对不透明且漫反射的固体表面进行三维重建。相机和线投影仪的安装必须使它们的主轴形成一个三角测量角。该三角测量角的值通常选在 30°至 60°之间。投射的光线在空间中定义了一个平面。该平面与被测固体的表面相交,从而构建出相机可见的表面轮廓(Profile)。通过在测量系统(即相机与线投影仪的组合)前方移动固体,可以记录下固体的整个表面。作为另一种方法,测量系统也可以在被测表面上方移动。请注意,轮廓图像中的轮廓必须大致保持水平方向,因为数据是按列逐列处理的。
如果拥有关于测量设置的几何信息,则可以计算出重建表面的真实三维坐标。有关所需几何(即标定)信息的概述,请参阅
set_sheet_of_light_paramset_sheet_of_light_paramSetSheetOfLightParamSetSheetOfLightParamSetSheetOfLightParamset_sheet_of_light_param 算子。如果没有此类信息,测量结果将是一幅视差图像,其中每个像素都记录了检测到的轮廓的亚像素级精确定位。
该操作会将激光三角测量模型的句柄返回至
SheetOfLightModelIDSheetOfLightModelIDSheetOfLightModelIDSheetOfLightModelIDsheetOfLightModelIDsheet_of_light_model_id 中,该句柄将用于后续对激光三角测量模型的所有操作,例如修改模型参数、测量轮廓、应用标定变换或访问测量结果。
必填输入图标参数
要进行测量,您需要设置以下输入图元参数:
- ProfileRegionProfileRegionProfileRegionProfileRegionprofileRegionprofile_region:定义轮廓图像的区域,该区域将由
measure_profile_sheet_of_lightmeasure_profile_sheet_of_lightMeasureProfileSheetOfLightMeasureProfileSheetOfLightMeasureProfileSheetOfLightmeasure_profile_sheet_of_light 算子进行处理。该区域应为矩形,可通过使用 gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1gen_rectangle1 算子等方式生成。如果传递给 ProfileRegionProfileRegionProfileRegionProfileRegionprofileRegionprofile_region 的区域不是矩形,则将使用其最小的包围矩形(边界框)。请注意,ProfileRegionProfileRegionProfileRegionProfileRegionprofileRegionprofile_region 仅在 measure_profile_sheet_of_lightmeasure_profile_sheet_of_lightMeasureProfileSheetOfLightMeasureProfileSheetOfLightMeasureProfileSheetOfLightmeasure_profile_sheet_of_light 算子中被考虑,而在处理视差图像时将被忽略。
激光三角测量模型参数的默认设置
选择了激光三角测量模型的默认设置,以便在基本配置下进行未校准的测量。以下列表概述了默认使用的参数值(有关所有受支持的泛型参数的详细说明,请参阅 set_sheet_of_light_paramset_sheet_of_light_paramSetSheetOfLightParamSetSheetOfLightParamSetSheetOfLightParamset_sheet_of_light_param):
- 'method'"method""method""method""method""method"
-
设置为 'center_of_gravity'"center_of_gravity""center_of_gravity""center_of_gravity""center_of_gravity""center_of_gravity"
- 'min_gray'"min_gray""min_gray""min_gray""min_gray""min_gray":
-
设置为 100
- 'num_profiles'"num_profiles""num_profiles""num_profiles""num_profiles""num_profiles"
-
设置为 512
- 'ambiguity_solving'"ambiguity_solving""ambiguity_solving""ambiguity_solving""ambiguity_solving""ambiguity_solving"
-
设置为 'first'"first""first""first""first""first"
- 'score_type'"score_type""score_type""score_type""score_type""score_type"
-
设置为 'none'"none""none""none""none""none"
- 'calibration'"calibration""calibration""calibration""calibration""calibration"
-
设置为 'none'"none""none""none""none""none"
修改激光三角测量模型参数
我们建议您根据具体的测量任务调整默认参数,以提高测量质量或缩短运行时间。如果您需要校准后的结果,还需修改模型参数的默认值。
create_sheet_of_light_modelcreate_sheet_of_light_modelCreateSheetOfLightModelCreateSheetOfLightModelCreateSheetOfLightModelcreate_sheet_of_light_model 提供了泛型参数
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name 和 GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value,用于修改大多数模型参数的默认值。请注意,模型参数也可以通过 set_sheet_of_light_paramset_sheet_of_light_paramSetSheetOfLightParamSetSheetOfLightParamSetSheetOfLightParamset_sheet_of_light_param 算子进行设置。不过,使用该算子时每次只能设置一个参数,而使用
create_sheet_of_light_modelcreate_sheet_of_light_modelCreateSheetOfLightModelCreateSheetOfLightModelCreateSheetOfLightModelcreate_sheet_of_light_model 则可以同时设置多个参数。有关所有受支持的通用参数的详细说明,请参阅
set_sheet_of_light_paramset_sheet_of_light_paramSetSheetOfLightParamSetSheetOfLightParamSetSheetOfLightParamset_sheet_of_light_param。
请注意,以下模型参数无法通过 create_sheet_of_light_modelcreate_sheet_of_light_modelCreateSheetOfLightModelCreateSheetOfLightModelCreateSheetOfLightModelcreate_sheet_of_light_model 算子设置,因此必须使用 set_sheet_of_light_paramset_sheet_of_light_paramSetSheetOfLightParamSetSheetOfLightParamSetSheetOfLightParamset_sheet_of_light_param 算子进行设置:'camera_parameter'"camera_parameter""camera_parameter""camera_parameter""camera_parameter""camera_parameter"、'camera_pose'"camera_pose""camera_pose""camera_pose""camera_pose""camera_pose"、'lightplane_pose'"lightplane_pose""lightplane_pose""lightplane_pose""lightplane_pose""lightplane_pose" 和
'movement_pose'"movement_pose""movement_pose""movement_pose""movement_pose""movement_pose"。
可以使用 get_sheet_of_light_paramget_sheet_of_light_paramGetSheetOfLightParamGetSheetOfLightParamGetSheetOfLightParamget_sheet_of_light_param 算子查询模型参数的值。query_sheet_of_light_paramsquery_sheet_of_light_paramsQuerySheetOfLightParamsQuerySheetOfLightParamsQuerySheetOfLightParamsquery_sheet_of_light_params 算子将返回所有受支持的模型参数的名称。
使用简化的激光三角测量模型参数
对于简单的设置,或者无需进行真正的度量标定时,可以使用激光三角测量模型的简化参数集来控制将观测到的视差转换为三维值:
通过将 set_sheet_of_light_paramset_sheet_of_light_paramSetSheetOfLightParamSetSheetOfLightParamSetSheetOfLightParamset_sheet_of_light_param 标定设置为
'offset_scale'"offset_scale""offset_scale""offset_scale""offset_scale""offset_scale",姿态和相机参数将被调整为特定值,使得 1 像素的偏移量对应三维结果中的 1 个单位。这使得能够基于未经校准的激光三角测量模型生成三维对象模型和三维图像。
从视差到三维坐标的转换可通过六个参数进行控制:
'scale_x'"scale_x""scale_x""scale_x""scale_x""scale_x"、'scale_y'"scale_y""scale_y""scale_y""scale_y""scale_y"、'scale_z'"scale_z""scale_z""scale_z""scale_z""scale_z"、'offset_x'"offset_x""offset_x""offset_x""offset_x""offset_x"、'offset_y'"offset_y""offset_y""offset_y""offset_y""offset_y"、'offset_z'"offset_z""offset_z""offset_z""offset_z""offset_z"。有关所有受支持的通用参数的详细说明,请参阅
set_sheet_of_light_paramset_sheet_of_light_paramSetSheetOfLightParamSetSheetOfLightParamSetSheetOfLightParamset_sheet_of_light_param。
在多个线程中使用句柄
请注意,在多个线程中使用激光三角测量模型(SheetOfLightModelIDSheetOfLightModelIDSheetOfLightModelIDSheetOfLightModelIDsheetOfLightModelIDsheet_of_light_model_id)的句柄时,必须格外小心。如果不同线程会修改该句柄,则不能在这些线程中并发使用同一个句柄。因此,如果线程调用了会更改句柄数据的算子,您必须格外小心。您可以在算子的 “注意” 部分找到相关提示。无论如何,如果您仍希望在不同线程中使用同一句柄,且这些线程会并发地向该句柄写入数据,则必须对线程进行同步,以确保它们不会同时访问同一句柄。如果您不确定使用同一句柄是否线程安全,请查阅相关参考手册条目的 “注意” 部分,看其中是否包含指向此问题的警告。不过,不同的句柄可以在不同的线程中独立且安全地使用。
执行信息
- 多线程类型:可重入(与非独占算子并行运行)。
- 多线程作用域:全局(可从任何线程调用)。
- 未采用并行化处理。
此算子返回一个句柄。请注意,即使该句柄被用作特定算子的输入参数,这些算子仍可能改变此句柄类型的实例状态。
参数
ProfileRegionProfileRegionProfileRegionProfileRegionprofileRegionprofile_region (输入对象) region → objectHRegionHObjectHRegionHobject
包含待处理轮廓的图像区域。如果提供的区域不是矩形,则将使用其最小的包围矩形。
GenParamNameGenParamNameGenParamNameGenParamNamegenParamNamegen_param_name (输入控制) attribute.name(-array) → HTupleMaybeSequence[str]HTupleHtuple (string) (string) (HString) (char*)
可用于调整激光三角测量模型的泛型参数名称。
默认值:
'min_gray'
"min_gray"
"min_gray"
"min_gray"
"min_gray"
"min_gray"
值列表:
'ambiguity_solving'"ambiguity_solving""ambiguity_solving""ambiguity_solving""ambiguity_solving""ambiguity_solving", 'calibration'"calibration""calibration""calibration""calibration""calibration", 'method'"method""method""method""method""method", 'min_gray'"min_gray""min_gray""min_gray""min_gray""min_gray", 'num_profiles'"num_profiles""num_profiles""num_profiles""num_profiles""num_profiles", 'offset_x'"offset_x""offset_x""offset_x""offset_x""offset_x", 'offset_y'"offset_y""offset_y""offset_y""offset_y""offset_y", 'offset_z'"offset_z""offset_z""offset_z""offset_z""offset_z", 'scale'"scale""scale""scale""scale""scale", 'scale_x'"scale_x""scale_x""scale_x""scale_x""scale_x", 'scale_y'"scale_y""scale_y""scale_y""scale_y""scale_y", 'scale_z'"scale_z""scale_z""scale_z""scale_z""scale_z", 'score_type'"score_type""score_type""score_type""score_type""score_type"
GenParamValueGenParamValueGenParamValueGenParamValuegenParamValuegen_param_value (输入控制) attribute.value(-array) → HTupleMaybeSequence[Union[int, float, str]]HTupleHtuple (integer / real / string) (int / long / double / string) (Hlong / double / HString) (Hlong / double / char*)
可用于调整激光三角测量模型的泛型参数值。
默认值:
50
建议值:
'default'"default""default""default""default""default", 'center_of_gravity'"center_of_gravity""center_of_gravity""center_of_gravity""center_of_gravity""center_of_gravity", 'last'"last""last""last""last""last", 'first'"first""first""first""first""first", 'brightest'"brightest""brightest""brightest""brightest""brightest", 'none'"none""none""none""none""none", 'intensity'"intensity""intensity""intensity""intensity""intensity", 'width'"width""width""width""width""width", 'offset_scale'"offset_scale""offset_scale""offset_scale""offset_scale""offset_scale", 50, 100, 150, 180
SheetOfLightModelIDSheetOfLightModelIDSheetOfLightModelIDSheetOfLightModelIDsheetOfLightModelIDsheet_of_light_model_id (输出控制) sheet_of_light_model → HSheetOfLightModel, HTupleHHandleHTupleHtuple (handle) (IntPtr) (HHandle) (handle)
用于使用和访问激光三角测量模型的句柄。
示例(HDevelop)
* Create the rectangular region in which the profiles are measured.
gen_rectangle1 (ProfileRegion, 120, 75, 195, 710)
*
* Create a model in order to measure profiles according to
* the sheet-of-light technique. Simultaneously set some
* parameters for the model.
create_sheet_of_light_model (ProfileRegion, ['min_gray','num_profiles', \
'ambiguity_solving','score_type'], \
[70,290,'first','width'], \
SheetOfLightModelID)
*
* Measure the profile from successive images
for Index := 1 to 290 by 1
read_image (ProfileImage, 'sheet_of_light/connection_rod_'+Index$'.3')
dev_display (ProfileImage)
dev_display (ProfileRegion)
measure_profile_sheet_of_light (ProfileImage, SheetOfLightModelID, [])
endfor
*
* Get the resulting disparity and score images
get_sheet_of_light_result (Disparity, SheetOfLightModelID, 'disparity')
get_sheet_of_light_result (Score, SheetOfLightModelID, 'score')
*
* Close the sheet-of-light handle once the measurement
* has been performed
结果
算子 create_sheet_of_light_modelcreate_sheet_of_light_modelCreateSheetOfLightModelCreateSheetOfLightModelCreateSheetOfLightModelcreate_sheet_of_light_model 在给定的参数正确时返回值 2 (H_MSG_TRUE)。否则,将抛出异常。
可能的前趋
gen_rectangle1gen_rectangle1GenRectangle1GenRectangle1GenRectangle1gen_rectangle1
可能的后继
set_sheet_of_light_paramset_sheet_of_light_paramSetSheetOfLightParamSetSheetOfLightParamSetSheetOfLightParamset_sheet_of_light_param,
measure_profile_sheet_of_lightmeasure_profile_sheet_of_lightMeasureProfileSheetOfLightMeasureProfileSheetOfLightMeasureProfileSheetOfLightmeasure_profile_sheet_of_light
另见
clear_sheet_of_light_modelclear_sheet_of_light_modelClearSheetOfLightModelClearSheetOfLightModelClearSheetOfLightModelclear_sheet_of_light_model,
calibrate_sheet_of_lightcalibrate_sheet_of_lightCalibrateSheetOfLightCalibrateSheetOfLightCalibrateSheetOfLightcalibrate_sheet_of_light
模块
三维计量