⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.html

📁 信号处理系列导航
💻 HTML
字号:
<!DOCTYPE html  PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"><html xmlns:mwsh="http://www.mathworks.com/namespace/mcode/v1/syntaxhighlight.dtd">   <head>      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">         <!--This HTML is auto-generated from an M-file.To make changes, update the M-file and republish this document.      -->      <title>Image Compression with Wavelets</title>      <meta name="generator" content="MATLAB 7.4">      <meta name="date" content="2008-10-15">      <meta name="m-file" content="index">      <LINK REL="stylesheet" HREF="style.css" TYPE="text/css">   </head>   <body>      <div class="content">         <h1>Image Compression with Wavelets</h1>         <introduction>            <p>This numerical tour uses wavelets to perform image compression.</p>         </introduction>         <h2>Contents</h2>         <div>            <ul>               <li><a href="#1">Installing toolboxes and setting up the path.</a></li>               <li><a href="#8">Wavelet Domain Quantization</a></li>               <li><a href="#12">Wavelet Compressor</a></li>            </ul>         </div>         <h2>Installing toolboxes and setting up the path.<a name="1"></a></h2>         <p>You need to download the <a href="../toolbox_general.zip">general purpose toolbox</a> and the <a href="../toolbox_signal.zip">signal toolbox</a>.         </p>         <p>You need to unzip these toolboxes in your working directory, so that you have <tt>toolbox_general/</tt> and <tt>toolbox_signal/</tt> in your directory.         </p>         <p><b>For Scilab user:</b> you must replace the Matlab comment '%' by its Scilab counterpart '//'.         </p>         <p><b>Recommandation:</b> You should create a text file named for instance <tt>numericaltour.sce</tt> (in Scilabe) or <tt>numericaltour.m</tt> to write all the Scilab/Matlab command you want to execute. Then, simply run <tt>exec('numericaltour.sce');</tt> (in Scilab) or <tt>numericaltour;</tt> (in Matlab) to run the commands.         </p>         <p>Execute this line only if you are using Matlab.</p><pre class="codeinput">getd = @(p)path(path,p); <span class="comment">% scilab users must *not* execute this</span></pre><p>Then you can add these toolboxes to the path.</p><pre class="codeinput"><span class="comment">% Add some directories to the path</span>getd(<span class="string">'toolbox_signal/'</span>);getd(<span class="string">'toolbox_general/'</span>);</pre><h2>Wavelet Domain Quantization<a name="8"></a></h2>         <p>Image compression is perfomed by quantizing the wavelet coefficients of an image.</p>         <p>A scalar quantizer of step size <tt>T</tt> uses the function <tt>floor</tt>. It has a twice larger zero bins.         </p><pre class="codeinput"><span class="comment">% bin size</span>T = .75;<span class="comment">% range of values</span>v = linspace(-3,3, 2048);<span class="comment">% quantized integer values</span>vI = floor(abs(v/T)).*sign(v);<span class="comment">% de-quantized values from vI</span>vQ = sign(vI) .* (abs(vI)+.5) * T;<span class="comment">% display</span>clf;subplot(1,2,1);plot(v, vI);axis(<span class="string">'equal'</span>); axis(<span class="string">'tight'</span>);title(strcat([<span class="string">'Quantized integer values, T='</span> num2str(T)]));subplot(1,2,2);hold(<span class="string">'on'</span>);plot(v, vQ);plot(v, v, <span class="string">'r--'</span>);hold(<span class="string">'off'</span>);axis(<span class="string">'equal'</span>); axis(<span class="string">'tight'</span>);title(<span class="string">'De-quantized real values'</span>);</pre><img vspace="5" hspace="5" src="index_01.png"> <p><i>Exercice 1:</i> (the solution is <a href="../private/coding_wavelet_compression/exo1.m">exo1.m</a>) Compare the effect of quantizing at <tt>T=.2</tt> and thresholding at <tt>T=.2</tt> the wavelet coefficients of an image.         </p><pre class="codeinput">exo1;</pre><img vspace="5" hspace="5" src="index_02.png"> <p><i>Exercice 2:</i> (the solution is <a href="../private/coding_wavelet_compression/exo2.m">exo2.m</a>) Compute the entropy of all the quantized wavelet coefficients, and compute the entropy of the first scales and of wavelets            quantized coefficients.         </p><pre class="codeinput">exo2;</pre><pre class="codeoutput">Entropy for all scales = 0.36913</pre><img vspace="5" hspace="5" src="index_03.png"> <h2>Wavelet Compressor<a name="12"></a></h2>         <p>A complete wavelet compressor is obtained with an arithmetic coding of each scale and orientation of the quantized wavelet            coefficients.         </p>         <p class="footer"><br>            Copyright  &reg; 2008 Gabriel Peyre<br></p>      </div>      <!--##### SOURCE BEGIN #####%% Image Compression with Wavelets% This numerical tour uses wavelets to perform image compression.%% Installing toolboxes and setting up the path.%%% You need to download the% <../toolbox_general.zip general purpose toolbox>% and the <../toolbox_signal.zip signal toolbox>.%%% You need to unzip these toolboxes in your working directory, so% that you have |toolbox_general/| and |toolbox_signal/| in your directory.%%% *For Scilab user:* you must replace the Matlab comment '%' by its Scilab% counterpart '//'.%%% *Recommandation:* You should create a text file named for instance% |numericaltour.sce| (in Scilabe) or |numericaltour.m| to write all the% Scilab/Matlab command you want to execute. Then, simply run% |exec('numericaltour.sce');| (in Scilab) or |numericaltour;| (in Matlab)% to run the commands.%%% Execute this line only if you are using Matlab.getd = @(p)path(path,p); % scilab users must *not* execute this%%% Then you can add these toolboxes to the path.% Add some directories to the pathgetd('toolbox_signal/');getd('toolbox_general/');%% Wavelet Domain Quantization% Image compression is perfomed by quantizing the wavelet coefficients of% an image.%%% A scalar quantizer of step size |T| uses the function |floor|. It has a% twice larger zero bins.% bin sizeT = .75;% range of valuesv = linspace(-3,3, 2048);% quantized integer valuesvI = floor(abs(v/T)).*sign(v);% de-quantized values from vIvQ = sign(vI) .* (abs(vI)+.5) * T;% displayclf;subplot(1,2,1);plot(v, vI);axis('equal'); axis('tight');title(strcat(['Quantized integer values, T=' num2str(T)]));subplot(1,2,2);hold('on');plot(v, vQ); plot(v, v, 'rREPLACE_WITH_DASH_DASH');hold('off'); axis('equal'); axis('tight');title('De-quantized real values');%%% _Exercice 1:_ (the solution is <../private/coding_wavelet_compression/exo1.m exo1.m>)% Compare the effect of quantizing at |T=.2| and thresholding at |T=.2|% the wavelet coefficients of an image.exo1;%%% _Exercice 2:_ (the solution is <../private/coding_wavelet_compression/exo2.m exo2.m>)% Compute the entropy of all the quantized wavelet coefficients, and compute the% entropy of the first scales and of wavelets quantized coefficients.exo2;%% Wavelet Compressor% A complete wavelet compressor is obtained with an arithmetic coding of% each scale and orientation of the quantized wavelet coefficients.##### SOURCE END #####-->   </body></html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -