Code covered by the BSD License  

Highlights from
Statistical Learning Toolbox

from Statistical Learning Toolbox by Dahua Lin
Functions for statistical learning, pattern recognition and computer vision, covering many topics.

Description of slbenchmark_batchfilter
Home > sltoolbox > imgproc > slbenchmark_batchfilter.m

slbenchmark_batchfilter

PURPOSE ^

SLBENCHMARK_BATCHFILTER Compares the efficiency of batch filter

SYNOPSIS ^

function recs = slbenchmark_batchfilter(imgsiz, nimgs, filtersiz, nfilters)

DESCRIPTION ^

SLBENCHMARK_BATCHFILTER Compares the efficiency of batch filter

 Input:
   imgsiz:     the size of each image
   nimgs:      the number of images
   filtersiz:  The size of each filter
   nfilters:   the list of numbers of filters

 History
   - Created by Dahua Lin, on Sep 2nd, 2006

CROSS-REFERENCE INFORMATION ^

This function calls:
  • disp DISP displays the dataset fields
  • slapplyfilterband SLAPPLYFILTERBAND Applies filter band to filter images in batch
This function is called by:

SUBFUNCTIONS ^

SOURCE CODE ^

0001 function recs = slbenchmark_batchfilter(imgsiz, nimgs, filtersiz, nfilters)
0002 %SLBENCHMARK_BATCHFILTER Compares the efficiency of batch filter
0003 %
0004 % Input:
0005 %   imgsiz:     the size of each image
0006 %   nimgs:      the number of images
0007 %   filtersiz:  The size of each filter
0008 %   nfilters:   the list of numbers of filters
0009 %
0010 % History
0011 %   - Created by Dahua Lin, on Sep 2nd, 2006
0012 
0013 
0014 imgs = rand([imgsiz, nimgs]);
0015 fb = rand([filtersiz, max(nfilters)]);
0016 
0017 names = {'imfilter', 'slapplyfilerband'};
0018 methods = {@test_imfilter, @test_slband};
0019 nmethods = length(names);
0020 
0021 recs = zeros(length(nfilters), nmethods);
0022 
0023 for k = 1 : nmethods
0024     
0025     curname = names{k};
0026     curmethod = methods{k};
0027     
0028     disp(['Test ', curname]);
0029     
0030     for i = 1 : length(nfilters)
0031         nf = nfilters(i);
0032         tic;
0033         curmethod(imgs, fb(:,:,1:nf));        
0034         recs(i, k) = toc;        
0035     end        
0036 end
0037 
0038 recs = recs / nimgs;
0039 
0040 
0041 function test_imfilter(imgs, fb)
0042 
0043 nf = size(fb ,3);
0044 R = zeros([size(imgs), nf]);
0045 for i = 1 : nf
0046     R(:,:,:,i) = imfilter(imgs, fb(:,:,i), 'replicate');
0047 end
0048 clear R;
0049 
0050 function test_slband(imgs, fb)
0051 
0052 fh = size(fb, 1);
0053 fw = size(fb, 2);
0054 R = slapplyfilterband(imgs, fb, [fh, fw]);
0055 clear R;
0056 
0057 
0058 
0059 
0060 
0061 
0062 
0063 
0064 
0065 
0066

Generated on Wed 20-Sep-2006 12:43:11 by m2html © 2003

Contact us at files@mathworks.com