Hello Mat

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

图像外扩指定区域大小

[复制链接]

1306

主题

1532

帖子

114

金钱

管理员

Rank: 9Rank: 9Rank: 9

积分
22685
发表于 2016-12-22 22:49:10 | 显示全部楼层 |阅读模式
外扩图像边界,paddingx,paddingy,卷积过程中常常使用:
  1. *关闭动态过程,特别是有For循环时,可看的清楚该函数的作用
  2. dev_update_off()
  3. * 只是显示Region区域的轮廓
  4. dev_set_draw('margin')
  5. * 读取一张图像
  6. read_image(Image, 'fabrik')
  7. get_image_size(Image, Width, Height)

  8. * 扩展一幅图像的周围
  9. expand_distance := 100
  10. * 产生一幅图像
  11. gen_image_const(Image1, 'byte', Width+2*expand_distance, Height+2*expand_distance)
  12. * 图像的灰度值为0
  13. gen_image_proto(Image1, Image1, 0)
  14. * 仿射变换
  15. hom_mat2d_identity(HomMat2DIdentity)
  16. hom_mat2d_translate(HomMat2DIdentity, expand_distance,expand_distance,HomMat2DTranslate)
  17. hom_mat2d_rotate(HomMat2DTranslate,0,Width/2+expand_distance,Height/2+expand_distance,HomMat2DRotate)
  18. affine_trans_image(Image,ImageAffinTrans, HomMat2DRotate, 'constant', 'true')
  19. * 右边、下边---扩展黑色区域
  20. overpaint_gray(Image1,ImageAffinTrans)
复制代码



图像四周各扩展100像素大小

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有帐号?立即注册

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

使用道具 举报

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

本版积分规则

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

GMT+8, 2024-6-16 16:54 , Processed in 0.201508 second(s), 23 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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