一、HSI彩色图像去噪简介

针对彩色图像中噪声难以去除的问题,根据HSI空间独特的色彩分离特点,对受高噪声污染的彩色图像的噪声去除进行了研究。首先将彩色图像投影到色彩特征空间HSI中,将色彩信息与亮度特征信息进行分离操作,然后对该空间中的色彩分量H和S提出极坐标下距离阈值去噪方法进行处理,在保持色彩不失真的情况下去除噪声。

HSI空间中,色调H与饱和度S均表示颜色信息,H分量通常以角度度量,S通常表示离I轴的远近程度,人类感知的色彩是这两个分量的合成。文献[2]中建立的色度模型保持了图像的色彩特性。文献[3]中基于这种模型,提出色度中值滤波器去除色彩中的噪声,虽然保真色彩,但滤掉的噪声点很少。本文在色度模型的基础上,在保持颜色不失真的情况下,构造了平均最小距离阈值,尽可能滤掉更多的噪声点,提出了极坐标中距离阈值去噪(distance threshold denoising in polar coordinates,DST),对H和S去除噪声,具体处理过程如下:

步骤1分块预处理。将彩色图像进行HSI分解后,对饱和度分量矩阵S和色调分量矩阵H进行相同的分块处理,块大小为r×c。将两个分量矩阵中任意相同位置的块记为块矩阵s、块矩阵h,并寻找块中像素点数值的最小值,分别记为sm in和hm in。

步骤2极坐标系下块中颜色量的定义。设块中任一点(m,n)处表示颜色的量为Cmn,且满足m=1,2,⋯,r;  n=1,2,⋯,c,若smn、hmn分别表示点(m,n)处的饱和度值和色调值,则对于块矩阵s和h,有smn=s(m,n),hmn=h(m,n),那么在极坐标系下可定义:

【图像去噪】基于matlab GUI HSI彩色图像去噪【含Matlab源码 1786期】_图像处理

其中,i为虚数单位。这说明用块矩阵s和h联合定义的块中每一个表示颜色的量都是个复数,点(i,j)处的颜色量Cij也是个复数。

步骤3距离阈值的设置。块中的点(i,j)与其他任一点(m,n)的距离dmnij可由下式计算。

【图像去噪】基于matlab GUI HSI彩色图像去噪【含Matlab源码 1786期】_计算机视觉_02

其中,在块矩阵s和h中,sij、hij是点(i,j)处的饱和度值和色调值,即sij=s(i,j),hij=h(i,j);smn、hmn是点(m,n)处的饱和度值和色调值,即smn=s(m,n),hmn=h(m,n)。

当m=1,2,⋯,r;n=1,2,⋯,c时,对于固定点(i,j),所有的dmnij可以构成像素点(i,j)与块中其他任意像素点的距离矩阵Dij∈Rr×c,设Dij中非0的最小值为dij,则块中每一个点对应一个非0的最小距离值。所有最小距离值的平均值可通过下式计算得到。

【图像去噪】基于matlab GUI HSI彩色图像去噪【含Matlab源码 1786期】_图像处理_03

步骤4噪声的消除。若在块中点(i,j)处有dij>d,则说明同等条件下该像素点与周围其他像素点的差距较大,相似性太小,在此处产生了突变。根据噪声点的突变型,可判断该点是噪声点,需要去除掉。设块中去除噪声后的饱和度和色调块矩阵分别为ends和endh,具体处理过程如下所示。

【图像去噪】基于matlab GUI HSI彩色图像去噪【含Matlab源码 1786期】_matlab_04

其中,i=1,2,⋯,r;j=1,2,⋯,c。对ends和endh进行分块逆变换,得到最终的去除噪声后的饱和度矩阵end S和色调矩阵end H。

二、部分源代码

function varargout = myHSI(varargin)
% MYHSI MATLAB code for myHSI.fig
% MYHSI, by itself, creates a new MYHSI or raises the existing
% singleton*.
%
% H = MYHSI returns the handle to a new MYHSI or the handle to
% the existing singleton*.
%
% MYHSI('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in MYHSI.M with the given input arguments.
%
% MYHSI('Property','Value',...) creates a new MYHSI or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before myHSI_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to myHSI_OpeningFcn via varargin.
%
% *See GUI Options on GUIDE's Tools menu. Choose "GUI allows only one
% instance to run (singleton)".
%
% See also: GUIDE, GUIDATA, GUIHANDLES

% Edit the above text to modify the response to help myHSI

% Last Modified by GUIDE v2.5 04-Mar-2022 13:01:39

% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @myHSI_OpeningFcn, ...
'gui_OutputFcn', @myHSI_OutputFcn, ...
'gui_LayoutFcn', [] , ...
'gui_Callback', []);
if nargin && ischar(varargin{1})
gui_State.gui_Callback = str2func(varargin{1});
end

if nargout
[varargout{1:nargout}] = gui_mainfcn(gui_State, varargin{:});
else
gui_mainfcn(gui_State, varargin{:});
end
% End initialization code - DO NOT EDIT


% --- Executes just before myHSI is made visible.
function myHSI_OpeningFcn(hObject, eventdata, handles, varargin)
% This function has no output args, see OutputFcn.
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% varargin command line arguments to myHSI (see VARARGIN)

% Choose default command line output for myHSI
handles.output = hObject;
axes(handles.axes1);
set(gca, 'vis', 'off')
axes(handles.axes2);
set(gca, 'vis', 'off')
axes(handles.axes3);
set(gca, 'vis', 'off')
axes(handles.axes4);
set(gca, 'vis', 'off')
% Update handles structure
guidata(hObject, handles);

% UIWAIT makes myHSI wait for user response (see UIRESUME)
% uiwait(handles.figure1);


% --- Outputs from this function are returned to the command line.
function varargout = myHSI_OutputFcn(hObject, eventdata, handles)
% varargout cell array for returning output args (see VARARGOUT);
% hObject handle to figure
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)

% Get default command line output from handles structure
varargout{1} = handles.output;


% --- 打开图像.
function pushbutton1_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
filter = { ...
'*.bmp;*.jpg;*.gif;*.emf', '所有图像文件 (*.bmp; *.jpg; *.gif; *emf)'; ...
'*.bmp', '位图文件 (*.bmp)'; ...
'*.jpg', 'JPEG文件 (*.jpg)'; ...
'*.gif', 'GIF文件 (*.gif)'; ...
'*.emf', '图元文件 (*.emf)'; ...
'*.*', '所有文件 (*.*)' ...
};

% 选择文件
[filename, pathname] = uigetfile( filter, '打开...');
if isequal(filename,0) | isequal(pathname,0), return, end

% 读入图像并显示
[X, map] = imread([pathname filename]);
% colormap(map)
% image(X)
axes(handles.axes1); cla reset;
imshow(X);title('原图');
% 设置坐标系为适合显示图像的方式
% axis image
set(gca, 'vis', 'off')
handles.I=X;
guidata(hObject, handles);

三、运行结果

【图像去噪】基于matlab GUI HSI彩色图像去噪【含Matlab源码 1786期】_像素点_05

四、matlab版本及参考文献

1 matlab版本

2014a

2 参考文献

[1] 蔡利梅.MATLAB图像处理——理论、算法与实例分析[M].清华大学出版社,2020.

[2]杨丹,赵海滨,龙哲.MATLAB图像处理实例详解[M].清华大学出版社,2013.

[3]周品.MATLAB图像处理与图形用户界面设计[M].清华大学出版社,2013.

[4]刘成龙.精通MATLAB图像处理[M].清华大学出版社,2015.

[5]杨培,高雷阜,訾玲玲.HSI空间上高噪声彩色图像去噪方法研究[J].计算机科学与探索. 2020,14(11)