QQ登录

只需一步,快速开始

工业视觉halcon inpainting_ct函数介绍

[ 复制链接 ]
inpainting_ct(Image, Region : InpaintedImage : Epsilon, Kappa, Sigma, Rho, ChannelCoefficients : )
inpainting_ct通过将图像信息从区域边界沿相干方向传输到该区域来绘制图像的缺失区域Region。

参数:
Image 输入的图像
Region 要修复的区域
InpaintedImage 已修改的输出图像
Epsilon 像素邻域的半径。
Kappa 锐度参数(百分数)。
Sigma 预平滑参数
Rho 方向估计的平滑参数。
ChannelCoefficients 通道权重。


例程:
例程将图像中拦网去除
2019-06-06_180702.jpg
read_image (Image, 'lynx')
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')
dev_display (Image)
Message := 'Image to be inpainted'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
stop ()
read_region (Region, 'lynx_mask')
dev_display (Image)
dev_set_color ('blue')
dev_display (Region)
Message := 'Inpainting region'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
stop ()
inpainting_ct (Image, Region, InpaintedImage, 13, 70, 1.2, 4, 1)
dev_display (InpaintedImage)
Message := 'Inpainted image'
disp_message (WindowHandle, Message, 'window', 12, 12, 'black', 'true')
执行结果为:
2019-06-06_182041.jpg

2.inpainting_mcf(Image, Region : InpaintedImage : Sigma, Theta, Iterations : )
inpainting_mcf通过平滑图像Image灰度值函数的水平线,
将与输入图像Image的区域Region 相邻的图像边缘扩展到区域内部,
并将它们的端点连接起来。
参数:
Image 输入的图像
Region 要修复的区域
InpaintedImage 已修改的输出图像
Sigma 导数算子的平滑。

Theta 时间步长。
Iterations 迭代次数。
例程:
dev_close_window ()
dev_open_window (0, 0, 672, 484, 'black', WindowHandle)
gen_cam_par_area_scan_division (0.0130507774353, -665.817817207, 1.4803417027e-5, 1.48e-5, 155.89225769, 126.70664978, 320, 240, CamParamL)
gen_cam_par_area_scan_division (0.0131776504517, -731.860636733, 1.47997569293e-5, 1.48e-5, 162.98210144, 119.301040649, 320, 240, CamParamR)
create_pose (0.153573, -0.003734, 0.0447354, 0.174289, 319.843388, 359.894955, 'Rp+T', 'gba', 'point', RelPose)
gen_binocular_rectification_map (MapL, MapR, CamParamL, CamParamR, RelPose, 1, 'geometric', 'bilinear', RectCamParL, RectCamParR, CamPoseRectL, CamPoseRectR, RectLPosRectR)
read_image (ImageL, 'stereo/board/board_l_01')
read_image (ImageR, 'stereo/board/board_r_01')
emphasize (ImageL, ImageL, 7, 7, 1)
emphasize (ImageR, ImageR, 7, 7, 1)
map_image (ImageL, MapL, ImageRectifiedL)
map_image (ImageR, MapR, ImageRectifiedR)
binocular_distance (ImageRectifiedL, ImageRectifiedR, DistanceImage, ScoreImageDistance, RectCamParL, RectCamParR, RectLPosRectR, 'ncc', 17, 17, 5, 10, 40, 1, 0.1, 'left_right_check', 'interpolation')
get_domain (DistanceImage, Domain)
complement (Domain, RegionInpaintingFull)
full_domain (DistanceImage, DistanceImageFull)
harmonic_interpolation (DistanceImageFull, RegionInpaintingFull, HarmonicDistanceImage, 0.00001)
get_image_size (DistanceImage, Width, Height)
clip_region (RegionInpaintingFull, RegionInpainting, 3, 3, Height - 4, Width - 4)
inpainting_mcf (HarmonicDistanceImage, RegionInpainting, InpaintedDistanceImage, 1, 0.5, 1000)
dev_display (DistanceImage)
dev_display (InpaintedDistanceImage)

3.inpainting_texture(Image, Region : InpaintedImage : MaskSize, SearchSize, Anisotropy, PostIteration, Smoothness : )
通过纹理传播来实现图像修改


参数
Image  输入的图像

Region 要修正的区域
InpaintedImage 结果图像
MaskSize 修正块的大小
SearchSize 查找窗大小
Anisotropy 边缘振幅对修正顺序的影响
PostIteration 用于人为影响减少的后迭代参数,有'min_grad', 'min_range_extension', 'none'
Smoothness 后迭代的灰度值公差。
例程:
例程实现将图像中枯杆去除
2019-06-06_180702.jpg
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')
执行结果
2019-06-06_182041.jpg

  

halcon从自学到接项目视频教程,另外再赠送全网最全资源  

  

欢迎围观我录制的一套halcon自学视频教程(进入)




回复

使用道具 举报

快速回复 返回列表 客服中心 搜索