一、简介

1974年,法国工程师J.Morlet首先提出小波变换的概念,1986年著名数学家Y.Meyer偶然构造出一个真正的小波基,并与S.Mallat合作建立了构造小波基的多尺度分析之后,小波分析才开始蓬勃发展起来。小波分析的应用领域十分广泛,在数学方面,它已用于数值分析、构造快速数值方法、曲线曲面构造、微分方程求解、控制论等。在信号分析方面的滤波、去噪声、压缩、传递等。在图像处理方面的图像压缩、分类、识别与诊断,去噪声等。本章将着重阐述小波在图像中的应用分析。
1 小波变换原理
小波分析是一个比较难的分支,用户采用小波变换,可以实现图像压缩,振动信号的分解与重构等,因此在实际工程上应用较广泛。小波分析与Fourier变换相比,小波变换是空间域和频率域的局部变换,因而能有效地从信号中提取信息。小波变换通过伸缩和平移等基本运算,实现对信号的多尺度分解与重构,从而很大程度上解决了Fourier变换带来的很多难题。
小波分析作一个新的数学分支,它是泛函分析、Fourier分析、数值分析的完美结晶;小波分析也是一种“时间—尺度”分析和多分辨分析的新技术,它在信号分析、语音合成、图像压缩与识别、大气与海洋波分析等方面的研究,都有广泛的应用。
(1)小波分析用于信号与图像压缩。小波压缩的特点是压缩比高,压缩速度快,压缩后能保持信号与图像的特征不变,且在传递中能够抗干扰。基于小波分析的压缩方法很多,具体有小波压缩,小波包压缩,小波变换向量压缩等。
(2)小波也可以用于信号的滤波去噪、信号的时频分析、信噪分离与提取弱信号、求分形指数、信号的识别与诊断以及多尺度边缘检测等。
(3)小波分析在工程技术等方面的应用概括的包括计算机视觉、曲线设计、湍流、远程宇宙的研究与生物医学方面。
2 多尺度分析【图像压缩】基于小波变换实现图像压缩matlab源码含 GUI_图像压缩
3 图像的分解和量化【图像压缩】基于小波变换实现图像压缩matlab源码含 GUI_图像压缩_02
4 图像压缩编码【图像压缩】基于小波变换实现图像压缩matlab源码含 GUI_图像压缩_03
5 图像编码评价【图像压缩】基于小波变换实现图像压缩matlab源码含 GUI_图像压缩_04

二、源代码

unction varargout = multi_wavelet(varargin)
 
% Begin initialization code - DO NOT EDIT
gui_Singleton = 1;
gui_State = struct('gui_Name',       mfilename, ...
                   'gui_Singleton',  gui_Singleton, ...
                   'gui_OpeningFcn', @multi_wavelet_OpeningFcn, ...
                   'gui_OutputFcn',  @multi_wavelet_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 multi_wavelet is made visible.
function multi_wavelet_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 multi_wavelet (see VARARGIN)
% Choose default command line output for multi_wavelet
handles.output = hObject;
 
% Update handles structure
guidata(hObject, handles);
 
% UIWAIT makes multi_wavelet wait for user response (see UIRESUME)
% uiwait(handles.figure1);
 
 
% --- Outputs from this function are returned to the command line.
function varargout = multi_wavelet_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 on button press in pushbutton1.
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)
global I ;
[fname,pname]=uigetfile('*.*');
I=imread(strcat(pname,'\',fname));
[m,n,k]=size(I);
if k~=1
I=rgb2gray(I);
end
I=double(I);
axes(handles.axes1);
imshow(mat2gray(I));
title('原始图像的灰度图');
 
% --- Executes on selection change in popupmenu1.
function popupmenu1_Callback(hObject, eventdata, handles)
% hObject    handle to popupmenu1 (see GCBO)
% eventdata  reserved - to be defined in a future version of MATLAB
% handles    structure with handles and user data (see GUIDATA)
 
% Hints: contents = get(hObject,'String') returns popupmenu1 contents as cell array
%        contents{get(hObject,'Value')} returns selected item from popupmenu1
 
global I ;
w1=get(handles.popupmenu1,'value')
switch w1   %选择小波基
case 1
   w2= 'bior 3.7';
case 2
    w2='bior 1.1';
case 3    
    w2='bior 1.3';
case 4    
    w2='bior 1.5';
case 5    
   w2='bior 2.2';
case 6   
   w2='bior 2.4';
case 7   
   w2= 'bior 2.6';
case 8   
    w2='bior 2.8';
case 9    
    w2='bior 3.1';
case 10    
    w2='bior 3.3';
case 11    
    w2='bior 3.5';
case 12    
    w2='bior 3.9';
case 13    
    w2='bior 4.4';
case 14    
    w2='bior 5.5';
case 15    
    w2='bior 6.8';
case 16    
    w2='db1';
case 17    
    w2='db4';
case 18    
    w2='db15';
end
disp('压缩前图像的大小');%显示文字
whos('I')           %显示图像属性
% 进行二维小波变换 'bior3.7'
[a,b] = wavedec2(I, 3,w2); % 分三层,wavedec2:2维多层小波分解
% 提取各层低频信息
c1 = appcoef2( a, b,w2, 1 );%提取二维小波分解低频系数
axes(handles.axes18);
imshow(c1, []);
title('第一层低频部分:');
ca1=wcodemat(c1,440,'mat',0);   %对第一层信息进行量化编码
axes(handles.axes2);
imshow(ca1, []);
title('第一次压缩后图像:');
disp('第一次压缩图像的大小');%显示文字
whos('ca1');
c2= appcoef2( a, b,w2, 2 );
axes(handles.axes19);
imshow(c2, []);
title('第二层低频部分:');
ca2=wcodemat(c2,440,'mat',0);   %对第一层信息进行量化编码
axes(handles.axes6);
  • 1.
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13.
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24.
  • 25.
  • 26.
  • 27.
  • 28.
  • 29.
  • 30.
  • 31.
  • 32.
  • 33.
  • 34.
  • 35.
  • 36.
  • 37.
  • 38.
  • 39.
  • 40.
  • 41.
  • 42.
  • 43.
  • 44.
  • 45.
  • 46.
  • 47.
  • 48.
  • 49.
  • 50.
  • 51.
  • 52.
  • 53.
  • 54.
  • 55.
  • 56.
  • 57.
  • 58.
  • 59.
  • 60.
  • 61.
  • 62.
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68.
  • 69.
  • 70.
  • 71.
  • 72.
  • 73.
  • 74.
  • 75.
  • 76.
  • 77.
  • 78.
  • 79.
  • 80.
  • 81.
  • 82.
  • 83.
  • 84.
  • 85.
  • 86.
  • 87.
  • 88.
  • 89.
  • 90.
  • 91.
  • 92.
  • 93.
  • 94.
  • 95.
  • 96.
  • 97.
  • 98.
  • 99.
  • 100.
  • 101.
  • 102.
  • 103.
  • 104.
  • 105.
  • 106.
  • 107.
  • 108.
  • 109.
  • 110.
  • 111.
  • 112.
  • 113.
  • 114.
  • 115.
  • 116.
  • 117.
  • 118.
  • 119.
  • 120.
  • 121.
  • 122.
  • 123.
  • 124.
  • 125.
  • 126.
  • 127.
  • 128.
  • 129.
  • 130.
  • 131.
  • 132.
  • 133.
  • 134.
  • 135.
  • 136.
  • 137.

三、运行结果

【图像压缩】基于小波变换实现图像压缩matlab源码含 GUI_图像压缩_05【图像压缩】基于小波变换实现图像压缩matlab源码含 GUI_图像压缩_06