基于块分类和字典优化的K-SVD图像去噪研究(MATLAB)
前言
(1) 输入原图像,添加泊松噪声,
(2) 采用二维变分模态分解进行预处理;将含噪图像分为高频图像和低频图像;
(3) 采用K-SVD算法训练高频图像对应的字典和低频图像对应的字典,训练完成的字典采用Bartlett检验法优化,最后用优化后的字典分别对高频和低频图像去噪;
(4) 最后将去噪的高频图像和低频图像进行融合,得到最终的去噪图像;
一、K-SVD算法介绍
K-SVD算法参考文献(基于块分类和字典优化的K-SVD图像去噪研究)
二、主要代码展示
MATLAB APP实现的代码
function varargout = Task1(varargin)
% Task2 M-file for Task2.fig
% Task2, by itself, creates a new Task2 or raises the existing
% singleton*.
%
% H = Task2 returns the handle to a new Task2 or the handle to
% the existing singleton*.
%
% Task2('CALLBACK',hObject,eventData,handles,...) calls the local
% function named CALLBACK in Task2.M with the given input arguments.
%
% Task2('Property','Value',...) creates a new Task2 or raises the
% existing singleton*. Starting from the left, property value pairs are
% applied to the GUI before Task2_OpeningFcn gets called. An
% unrecognized property name or invalid value makes property application
% stop. All inputs are passed to Task2_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 Task2
% Last Modified by GUIDE v2.5 08-Jan-2023 16:13:54
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name', mfilename, ...
'gui_Singleton', gui_Singleton, ...
'gui_OpeningFcn', @Task2_OpeningFcn, ...
'gui_OutputFcn', @Task2_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 Task2 is made visible.
function Task2_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 Task2 (see VARARGIN)
% Choose default command line output for Task2
% 初始化界面图像显示的Figure
a = ones(8,8);
imshow(a, 'Parent', handles.axes1);
imshow(a, 'Parent', handles.axes2);
imshow(a, 'Parent', handles.axes3);
imshow(a, 'Parent', handles.axes4);
imshow(a, 'Parent', handles.axes5);
imshow(a, 'Parent', handles.axes6);
imshow(a, 'Parent', handles.axes7);
guidata(hObject, handles);
% UIWAIT makes Task2 wait for user response (see UIRESUME)
% uiwait(handles.figure1);
% --- Outputs from this function are returned to the command line.
function varargout = Task2_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;
% --- Executes during object creation, after setting all properties.
function edit4_CreateFcn(hObject, eventdata, handles)
% hObject handle to edit2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: edit controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get