生成点云的程序
- This program demonstrates how to perform a non calibrated
- measurement by using the sheet-of-light technique
- At first, a sheet-of light model is created and suitable
- parameters are set. Then, a series of profile images is
- processed successively. Lastly, the resulting disparity
- and score images are retrieved from the model and displayed.
- Perform some initializations
dev_update_off ()
dev_close_window ()
read_image (ProfileImage, ‘sheet_of_light/connection_rod_001’)
dev_open_window_fit_image (ProfileImage, 0, 0, 1024, 768, WindowHandle)
dev_set_draw (‘margin’)
dev_set_line_width (3)
dev_set_color (‘lime green’)
dev_set_lut (‘default’) - Create the rectangular region in which the profiles are measured.
gen_rectangle1 (ProfileRegion, 1, 1, 26780, 16840) - 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)
for Idx := 1 to 3 by 1
*
* Measure the profile from successive images
for Index := 1 to 290 by 1
read_image (ProfileImage, ‘E:/33/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’)
*
* Further process the disparity and score images to remove
* unreliable values and improve the representation
if (Idx == 1)
threshold (Score, ScoreRegion, 1.5, 7.5)
reduce_domain (Disparity, ScoreRegion, DisparityReduced)
*
* Display the resulting disparity
get_image_size (DisparityReduced, Width, Height)
dev_set_window_extents (0, 0, Width, Height)
dev_set_part (0, 0, Height - 1, Width - 1)
dev_clear_window ()
endif
dev_set_lut (‘temperature’)
dev_clear_window ()
dev_display (DisparityReduced)
dev_set_lut (‘default’)
*
* reset the model for the next measurement
reset_sheet_of_light_model (SheetOfLightModelID)
wait_seconds (3)
endfor
总结:gen_rectangle1 (ProfileRegion, 1, 1, 26780, 16840)
指令为产生一个矩形,1.1是矩形起点坐标,26780,16840是矩形斜对角点。矩形内生成点云图像。
现在因为是红色遮光片,短曝光看不到蓝色激光,所以尝试慢速移动工件,曝光时间长,但目前生成结果来看,有轮廓,但是很稀疏。
测试的工件一定要反激光,比如黑色工件无法反光不好测。