halcon中有一组纹理修复的算子,比较有趣。我们来了解一下,也许在以后的某个项目中可以用得上也保不准。
它们是:
harmonic_interpolation
功能:对一个图像区域执行谐波插值。
inpainting_aniso
功能:通过各向异性扩散执行图像修复。
inpainting_ced
功能:通过一致性增强扩散执行图像修复。
inpainting_ct
功能:通过连贯传送执行图像修复。
inpainting_mcf
功能:通过水平线平滑执行图像修复。
inpainting_texture
功能:通过结构传导执行图像修复。
下面的演示是算子inpainting_texture

原图

这是修复纹理后图像,其中树木去掉了。
* 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,转载请注明出处!讨论可扫码加群:



少有人走的路



















