Halcom 发表于 2017-3-24 22:40:09

逐行读取并写入图像灰度值

获取图像的一行灰度值,并且将这一行灰度值,写入另一幅图像的某一行
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), , Grayval)
    * 逐行写入灰度值
    set_grayval (Image, gen_tuple_const(ProfileWidth,Index), , Grayval)
    if (Index % 5 == 0)
      dev_display (Image)
    endif
    Message := 'Measure reference object'
    Message := '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')



页: [1]
查看完整版本: 逐行读取并写入图像灰度值