图像处理----去雾技术

全局直方图去雾技术

优点:算法简单

缺点:彩色图像容易失真

function In = RemoveFogByGlobalHisteq(I, flag)
%对RGB图像进行均衡化处理,得到新的RGB图像
%输入参数:I-图像矩阵,flag-显示图标,输出参数:In-结果图像。
%函数输入参数的个数
I=imread('sweden_input.jpg');
%函数输入参数的个数
if nargin < 2
    flag = 1;
end


%%%提取图像的R、G、B分量
R = I(:,:,1);
G = I(:,:,2);
B = I(:,:,3);

%%%分别对图像的RGB分量进行全局直方图的均衡化
M = histeq(R);
N = histeq(G);
L = histeq(B);
In = cat(3, M, N, L);

%%%结果
if flag
    figure;
    subplot(2, 2, 1); imshow(I); title('原图像', 'FontWeight', 'Bold');
    subplot(2, 2, 2); imshow(In); title('处理后的图像', 'FontWeight', 'Bold');
    Q = rgb2gray(I);
    W = rgb2gray(In);
    subplot(2, 2, 3); imhist(Q, 64); title('原灰度直方图', 'FontWeight', 'Bold');
    subplot(2, 2, 4); imhist(W, 64); title('处理后的灰度直方图', 'FontWeight', 'Bold');
end

结果

发布了2 篇原创文章 · 获赞 2 · 访问量 208

猜你喜欢

转载自blog.csdn.net/weixin_42104238/article/details/104344713