【图像增强】基于区域相似变换函数和蜻蜓算法实现灰度图像增强附Matlab代码

171 阅读2分钟

1 简介

Image enhancement is a necessary and indispensable technique for increasing the quality of digital images. The main task is to generate a new intensity value for each pixel in the image using a transformation function after the input image receives the intensity value of each pixel. The proposed transfer function in this study is called the Regional Similarity Transfer Function (RSTF) that considers the density distribution similarity between adjoining pixels. Dragonfly Algorithm (DA) intuitive optimization technique, which is preferred in engineering applications, has been used to optimize the parameter values of the proposed transfer function. Image quality evaluation is performed with six criteria between the improved and original images. Our experimental results show that the intensity distribution between adjoining pixels show an increase in contrast and brightness over the similarity degree. Excessive brightness, blur, and deterioration in the images is resolved with the proposed method.

2 部分代码

% Using the Regional Similarity Transformation Function and Dragonfly Algorithm. 

%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%THIS IS A DEMO FOR NOVEL IMAGE ENHANCEMENT USING GRAV脻TAT脻ONAL SEARCH ALGORITHM 

clc;

clear all;

close all;

%READ IMAGE

i=imread('test5.bmp');

i=imresize(i,1);  

%--------------------------------------------------------------------------

%GLOBAL MEAN

frekans=zeros(256,1);

% It records by counting how many times each pixel value is.

for k=1:size(i,1)

    for l=1:size(i,2)

        value=i(k,l);

       frekans(value+1)=frekans(value+1)+1; 

    end

end

deger=max(frekans);

for k=1:256

    if deger==frekans(k)

        D=k;

    end

end

D=double(D/255);

image = im2double(i);

global_mean = D;

%--------------------------------------------------------------------------

% LOCAL MEAN

Bmean = mean_n(image);

%--------------------------------------------------------------------------

%SIMILARITY

[S]=similarity(i);

B=double(S);

%--------------------------

C = std_n(image,Bmean);

im_size = size(image);

%-------------------------------------------------------------------------

%OPTIMIZATION PARAMETERS

N=15; % Agent number;

Max_iteration=15;

%-------------------------------------------------------------------------

%CALL FUNCTION 

[parameters Fbest BestChart MeanChart] = GSA_enhancement2(image,global_mean,B,C,im_size, N, Max_iteration);

enh = trans(i,image, B, C, global_mean, parameters(1),parameters(2),parameters(3),parameters(4) );

figure;

subplot(121)

imshow(image);

title('原图')

subplot(122)

imshow(enh);

   title('GSA增强后的灰度图')

3 仿真结果

4 参考文献

[1]朱逢园. 基于MATLAB的图像增强算法研究及实现[J]. 价值工程, 2020, 39(25):2.

[2] Katirciolu F ,  Cngz Z . A Novel Gray Image Enhancement Using the Regional Similarity Transformation Function and Dragonfly Algorithm[J]. El-Cezeri Fen ve Mühendislik Dergisi, 2020.​

博主简介:擅长智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,相关matlab代码问题可私信交流。

部分理论引用网络文献,若有侵权联系博主删除。