TA的每日心情 | 衰 2021-4-12 09:22 |
---|
签到天数: 4 天 连续签到: 1 天 [LV.2]偶尔看看I


- 积分
- 57

|
51Halcon诚邀您的加入,专注于机器视觉开发与应用技术,我们一直都在努力!
您需要 登录 才可以下载或查看,没有账号?会员注册
x
dev_update_off ()
dev_close_window ()
read_image (Image, 'tt (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')
|
|