halcon去霧

**********************************
*何凯明博士去雾算法代码实现
*论文:<<Single Image Haze Removal Using Dark Channel Prior>>
*编写时间:2016-04-11
*作者:datiansong
**********************************
dev_update_off ()
dev_close_window ()
read_image (Image, '雾图1')
get_image_size (Image, Width, Height)
dev_open_window (0, 0, Width, Height, 'black', WindowHandle)
dev_display (Image)
disp_message (WindowHandle, '原图像', 'window', 12, 12, 'red', 'false')
*转换图像类型,用于后续运算
convert_image_type (Image, IxImage, 'real')
*求取暗通道图像
decompose3 (IxImage, R, G, B)
min_image (R, G, ImageMin)
min_image (ImageMin, B, ImageMin1)
gray_erosion_rect (ImageMin1, DarkChannelImage, 15, 15)
*计算全球大气光成分A的值
min_max_gray (DarkChannelImage, DarkChannelImage, 0.1, Min, Max, Range)
threshold (DarkChannelImage, Region, Max, 255)
min_max_gray (Region, IxImage, 0, Min1, A, Range1)
*计算透视率预估值tx
scale_image (IxImage, ImageScaled, 1/A, 0)
decompose3 (ImageScaled, R1, G1, B1)
min_image (R1, G1, ImageMin2)
min_image (ImageMin2, B1, ImageMin3)
gray_erosion_rect (ImageMin3, ImageMin4, 15, 15)
scale_image (ImageMin4, txImage, -0.95, 1)
*设定阈值T0,如果t<T0,则t=T0
T0:=0.1
threshold (txImage, Region1, 0, T0)
paint_region (Region1, txImage, txImage, T0, 'fill')
*求取去雾后的图像
scale_image (IxImage, ImageScaled1, 1, -A)
decompose3 (ImageScaled1, R2, G2, B2)
div_image (R2, txImage, ImageResultR, 1, A)
div_image (G2, txImage, ImageResultG, 1, A)
div_image (B2, txImage, ImageResultB, 1, A)
compose3 (ImageResultR, ImageResultG, ImageResultB, JxImage)
dev_open_window (0, 0+Width, Width, Height, 'black', WindowHandle1)
dev_display (JxImage)
disp_message (WindowHandle1, '去雾图', 'window', 12, 12, 'green', 'false')

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值