Hello Mat

 找回密码
 立即注册
查看: 8945|回复: 0

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

[复制链接]

1294

主题

1520

帖子

112

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22635
发表于 2017-3-24 22:40:09 | 显示全部楼层 |阅读模式
获取图像的一行灰度值,并且将这一行灰度值,写入另一幅图像的某一行
  1. NumProfiles := 441
  2. DisparityRange := 512
  3. ProfileWidth := 626
  4. * Init display
  5. dev_update_off ()
  6. dev_close_window ()
  7. dev_open_window_fit_size (0, 0, ProfileWidth, NumProfiles, -1, -1, WindowHandle)
  8. set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
  9. * 初始化一幅图像
  10. gen_image_const (Image, 'uint2', ProfileWidth, NumProfiles)
  11. * main loop
  12. for Index := 0 to NumProfiles - 1 by 1
  13.     read_image (ImageModel, 'sheet_of_light/metal_part_1_disparity_line_' + Index $ '03d')
  14.     * 逐行读取灰度值
  15.     get_grayval (ImageModel, gen_tuple_const(ProfileWidth,0), [0:ProfileWidth - 1], Grayval)
  16.     * 逐行写入灰度值
  17.     set_grayval (Image, gen_tuple_const(ProfileWidth,Index), [0:ProfileWidth - 1], Grayval)
  18.     if (Index % 5 == 0)
  19.         dev_display (Image)
  20.     endif
  21.     Message := 'Measure reference object'
  22.     Message[1] := 'Add profile ' + (Index + 1) + '/' + NumProfiles
  23.     disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
  24. endfor
  25. Message := 'Prepare the model for distance measurement ...'
  26. disp_message (WindowHandle, Message, 'window', 60, 12, 'black', 'true')
复制代码



算法QQ  3283892722
群智能算法链接http://halcom.cn/forum.php?mod=forumdisplay&fid=73
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

Python|Opencv|MATLAB|Halcom.cn ( 蜀ICP备16027072号 )

GMT+8, 2024-5-4 04:21 , Processed in 0.224824 second(s), 21 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表