这是一篇转载贴子:
https://blog.csdn.net/wuan584974722/article/details/53764769
此文章对应的是类似于Retinex算法,见贴子: http://47.98.154.65/?id=320
********************************** *何凯明博士去雾算法代码实现 *论文:<<Single Image Haze Removal Using Dark Channel Prior>> *编写时间:2016-04-11 *作者:datiansong ********************************** dev_update_off () dev_close_window () read_image (Image, '雾图2') 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')
本文出自勇哥的网站《少有人走的路》wwww.skcircle.com,转载请注明出处!讨论可扫码加群:


