Inpainting图像修复系列:演示纹理修复,把背景中的树木去掉


halcon中有一组纹理修复的算子,比较有趣。我们来了解一下,也许在以后的某个项目中可以用得上也保不准。

它们是:


harmonic_interpolation

功能:对一个图像区域执行谐波插值。

inpainting_aniso

功能:通过各向异性扩散执行图像修复。

inpainting_ced

功能:通过一致性增强扩散执行图像修复。

inpainting_ct

功能:通过连贯传送执行图像修复。

inpainting_mcf

功能:通过水平线平滑执行图像修复。

inpainting_texture

功能:通过结构传导执行图像修复。


下面的演示是算子inpainting_texture

image.png

原图

image.png

这是修复纹理后图像,其中树木去掉了。


* This example program shows how inpainting_texture can be used to remove
* unwanted objects from an image and replace them with natural looking
* texture
dev_update_off ()
read_image (Image, 'plit2')
get_image_size (Image, Width, Height)
dev_close_window ()
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
set_display_font (WindowHandle, 16, 'mono', 'true', 'false')
decompose3 (Image, ImageR, ImageG, ImageB)
trans_from_rgb (ImageR, ImageG, ImageB, ImageH, ImageS, ImageV, 'hsv')
threshold (ImageV, Region, 0, 120)
reduce_domain (ImageS, Region, ImageReduced)
threshold (ImageReduced, Region, 0, 120)
dilation_circle (Region, RegionDilation, 2.5)
opening_circle (RegionDilation, RegionTrees, 6.5)
dev_display (Image)
Message := 'Original image'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
stop ()
dev_display (Image)
dev_set_color ('white')
dev_set_draw ('margin')
dev_set_line_width (3)
dev_display (RegionTrees)
Message := 'Region to be inpainted'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
stop ()
inpainting_texture (Image, RegionTrees, InpaintedImage, 11, 40, 0, 'none', 0)
dev_display (InpaintedImage)
Message := 'Result of the inpainting'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')


--------------------- 

作者:hackpig

来源:www.skcircle.com

版权声明:本文为博主原创文章,转载请附上博文链接!



本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。

会员中心
搜索
«    2024年4月    »
1234567
891011121314
15161718192021
22232425262728
2930
网站分类
标签列表
最新留言
    热门文章 | 热评文章 | 随机文章
文章归档
友情链接
  • 订阅本站的 RSS 2.0 新闻聚合
  • 扫描加本站机器视觉QQ群,验证答案为:halcon勇哥的机器视觉
  • 点击查阅微信群二维码
  • 扫描加勇哥的非标自动化群,验证答案:C#/C++/VB勇哥的非标自动化群
  • 扫描加站长微信:站长微信:abc496103864
  • 扫描加站长QQ:
  • 扫描赞赏本站:
  • 留言板:

Powered By Z-BlogPHP 1.7.2

Copyright Your skcircle.com Rights Reserved.

鄂ICP备18008319号


站长QQ:496103864 微信:abc496103864