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

📄 decdemo.m

📁 NONSUBSAMPLED CONTOURLET TRANSFORM FILTER DESIGN AND APPLICATIONS
💻 M
字号:
function coeffs = decdemo( im, option )% DECDEMO   Demonstrates contourlet decomposition and reconstruction. 显示contourlet分解与重构%%   DECDEMO shows how to use the contourlet toolbox to decompose说明如何使用contourlet工具箱分解%   and reconstruct an image. 重塑形象 It provides a sample script that uses %   basic functions such as pdfbdec, pdfbrec, showpdfb.%%   It can be modified for applications such as image analysis, %   image retrieval and image processing.%%   While displaying images, the program will pause and wait for your response.%   When you are ready, you can just press Enter key to continue.%%       decdemo( [im, option] )%% Input:%	image:  a double or integer matrix for the input image.%           The default is the zoneplate image.%   option: option for the demos. The default value is 'auto'%       'auto' ------  automtatical demo, no input%       'user' ------  semi-automatic demo, simple interactive inputs%       'expert' ----  mannual, complete interactive inputs. %                      (Not implmented in this version)%% Output:%	coeffs: a cell vector for the contourlet decomposition coefficients.%   % See also:     PDFBDEC, PDFBREC, SHOWPDFB% History:%   10/20/2003  Creation.%   10/22/2003  Change the user interface for better image display.disp('Welcome to the contourlet decomposition demo! :)');disp('Type help decdemo for help' ) ;disp('You can also view decdemo.m for details.') ;disp(' ');% Input imageif ~exist('im', 'var')    % Zoneplate image: good for illustrating multiscale and directional    % decomposition    im = imread ('barbara.png') ;end% Show the input imagedisp( 'Displaying the input image...');clf;imagesc(im, [0, 255]);title( 'Input image' ) ;axis image off;colormap(gray);input( 'Press Enter key to continue...' ) ;disp( ' ' );%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Image decomposition by contourlets using the % pyramidal directional filter bank (PDFB).%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Parameteters:nlevels = [0, 2, 3, 4] ;        % Decomposition levelpfilter = 'pkva' ;              % Pyramidal filterdfilter = 'pkva' ;              % Directional filter% Contourlet decompositioncoeffs = pdfbdec( double(im), pfilter, dfilter, nlevels );% Display the coefficientsdisp('Displaying the contourlet coefficients...') ;imcoeff = showpdfb( coeffs ) ;title('Contourlet coefficients');input('Press Enter key to continue...' ) ;disp(' ');%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Pyramidal directional filter bank (PDFB) reconstruction.% This is the inverse of pdfbdec, i.e.% imrec = pdfbrec(coeffs, pfilter, dfilter);% would reconstruct imrec = im%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% Reconstruct imageimrec = pdfbrec( coeffs, pfilter, dfilter ) ;disp('Displaying the reconstructed image...') ;disp('It should be a perfect reconstruction' ) ;disp(' ') ;% Show the reconstruction image and the original imagesubplot(1,2,1), imagesc( im, [0, 255] ); title('Original image' ) ;axis image off;subplot(1,2,2), imagesc( imrec, [0, 255] );title('Reconstructed image' ) ;axis image off;mse = sum( sum( (imrec - double(im)).^2 ) );mse = mse / prod(size(im));disp( sprintf('The mean square error is: %f', mse ) );disp(' ');

⌨️ 快捷键说明

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