|
获取图像的一行灰度值,并且将这一行灰度值,写入另一幅图像的某一行
- NumProfiles := 441
- DisparityRange := 512
- ProfileWidth := 626
- * Init display
- dev_update_off ()
- dev_close_window ()
- dev_open_window_fit_size (0, 0, ProfileWidth, NumProfiles, -1, -1, WindowHandle)
- set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
- * 初始化一幅图像
- gen_image_const (Image, 'uint2', ProfileWidth, NumProfiles)
- * main loop
- for Index := 0 to NumProfiles - 1 by 1
- read_image (ImageModel, 'sheet_of_light/metal_part_1_disparity_line_' + Index $ '03d')
- * 逐行读取灰度值
- get_grayval (ImageModel, gen_tuple_const(ProfileWidth,0), [0:ProfileWidth - 1], Grayval)
- * 逐行写入灰度值
- set_grayval (Image, gen_tuple_const(ProfileWidth,Index), [0:ProfileWidth - 1], Grayval)
- if (Index % 5 == 0)
- dev_display (Image)
- endif
- Message := 'Measure reference object'
- Message[1] := 'Add profile ' + (Index + 1) + '/' + NumProfiles
- disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
- endfor
- Message := 'Prepare the model for distance measurement ...'
- disp_message (WindowHandle, Message, 'window', 60, 12, 'black', 'true')
复制代码
|
|