Research on Color Image Enhancement Algorithm Based on Homomorphic Filtering Based on Matlab

        Enhancing useful information in an image, which can be a distortion process, is intended to improve the visual effect of an image for a given image's application. Purposefully emphasize the overall or local characteristics of the image, make the original unclear image clear or emphasize some interesting features, expand the difference between the features of different objects in the image , suppress the uninteresting features, and improve the image. Quality, rich information, strengthen image interpretation and recognition effect, to meet the needs of some special analysis.

Homomorphic filtering
Homomorphic filtering uses the illumination-reflection model, that is, the image is enhanced by simultaneously reducing the grayscale range of the image and enhancing the contrast of the image. The image can be expressed as illumination i(x,y) and reflection r(x ,y) The product of the two parts.

 In this paper, in the HSI color space, the I component is processed, cropped into n×n image blocks of the same size, and homomorphic filtering is performed to achieve local enhancement. effect, so this side effect needs to be addressed. Then, the adjacent image blocks are divided into horizontal and vertical categories, and the pixels on the left and right sides of the boundary are used for mean filtering to eliminate the block effect. The enhanced I component is recombined with the S and H components and restored to RGB space.

  • Homomorphic filter implementation
function im_e = HomoMor(im,Hh,Hl,D0,c)
% 高斯同态滤波器参数的设置
% Hh = 1.2;  % 高频增益,需要大于1
% Hl = 0.5;  % 低频增益,取值在0和1之间
% D0 = 4;    % 截止频率,越大图像越亮
% c = 1;     % 锐化系数

%% 滤波器初始化
im = double(im);
[row, col] = size(im);

% 确定傅里叶变换的原点
x0 = floor(row/2);
y0 = floor(col/2);

% 初始化
H = zeros(row,col);

for i = 1:row
    for j = 1:col
        D = (i-x0)^2 + (j-y0)^2;
        if D == 0
            H(i,j) = Hl;
        else
            H(i,j) = (Hh-Hl) * (1 - exp(-c*D^2/(D0^2))) + Hl;
            % 高斯同态滤波函数
        end
    end
end

%% 同态滤波
im_l = log(im + 0.000001);              % 取对数变换
im_f = fftshift(fft2(im_l));            % 傅里叶变换,并移到中心位置
im_nf = H .* im_f;                      % 高斯滤波
im_n = real(ifft2(ifftshift(im_nf)));   % 傅里叶反变换,恢复位置
im_e = exp(im_n - 0.000001);            % 取指数变化

end

Test Results

 For detailed code and other information, please click: 134-170-3358;

 

Guess you like

Origin blog.csdn.net/Jiangtagong/article/details/123743510