I ndimshp 2 1 isrealhp I isnumerichp f l lengthhp remf1 2 0 e r r o r L P and

# I ndimshp 2 1 isrealhp i isnumerichp f l lengthhp

This preview shows page 129 - 131 out of 302 pages.

I (ndims(hp) -= 2) 1 -isreal(hp) I -isnumeric(hp) . . . ( ( f l -= length(hp) ) ( rem(f1, 2) -= 0 e r r o r ( [ ' L P and HP must be even and equal length real, ' ... 'numeric f i l t e r v e c t o r s . ' ] ) ; end i f - i s r e a l ( n ) I -isnumeric(n) I (n < 1) I (n > logZ(max(sx))) e r r o r ( [ ' N must be a r e a l scalar between 1 and ' ... 'log2(rnax(size((X))).']); end 7.2 a The Fast the s t a r t i n g output data structures and i n i t i a l approximati s = sx; app = double(x); ach decomposition . . . xtend the approximation symmetrically. p, keep] = symextend(app, f l ) ; onvolve rows with HP and downsample. Then convolve columns i t h HP and LP t o get the diagonal and v e r t i c a l coefficients. s = symconv(app, hp, 'row', fl, keep); fs = symconv(rows, hp, ' c o l ' , fl, keep); - [ c o e f s ( : ) ' c ] ; s = [ s i z e ( c o e f s ) ; s ] ; efs = symconv(rows, l p , ' c o l t , fl, keep) ; volve rows with LP and downsample. Then convolve columns h HP and LP t o get the horizontal and next approximation = symconv(app, l p , 'row', f 1, keep) ; = syrnconv(rows, hp, ' c o l ' , f 1, keep) ; symconv(rows, l p , ' c o l ' , fl, keep); f i n a l approximation structures. ( : ) ' c l ; s = [size(app); s]; ---_---_---.---_-------------------------------*------ n [y, keep] = symextend(x, f l ) t e the number of coefficients t o keep a f t e r convolution ownsampling. Then extend x i n both dimensions. = f l o o r ( ( f 1 + size(x) - 1) / 2); adarray(x, [ ( f l - 1) ( f l - 1) 1, 'symmetric', ' b o t h ' ) ; . - - - _ - - _ - - _ _ _ - - - - - - - - - - - - - - - - - - * - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - ion y = symconv(x, h, type, fl, keep) volve' the rows or columns of x with h, downsample, extract the Center section since symmetrically extended. rcmp(type, 'row') = y(:, 1:2:end); = y(:, f l 1 2 + 1 : f l 1 2 + keep(2)); = conv2(x, h ' ) ; = y(l:2:end, :); = y ( f 1 / 2 + 1 : f l / 2 + keep(l), :); Iave . - % - % 'let Transform C = c o n v 2 ( A , B ) performs the 2-D convol~rrion of no- trices A and B. 258 Chapter 7 3 EXAMPLIE 7.3: Comparing the execution times of wavefast and wavedec2. Wavelets flecting f 1 - 1 of its elements (the length of the decomposition filter minu; across its border. Function symextend returns an extended matrix of approximation toe_ cients and the number of pixels that should be extracted from the cente?' 4 any subsequently convolved and downsampled results. The rows of the & paragraph. ~ o n v o l v e d output, rows, is then submitted to symconv to convc are inserted into decomposition vector c (working from the last element ward the first) and the process is repeated in accordance with Fig. 7.2 tog erate the horizontal detail and approximation coefficients (the bottom t d branches of the figure). Function symconv uses the conv2 function to do the bulk of the transfc computation work. It convolves filter h with the rows or columns of x (dt convolution; using column filter vector h ' results in a columnwise convolutio~ As can be seen in the main routine, only one f o r loop, which cycles thr the decomposition levels (or scales) that are generated, is used to orch the entire forward transform computation. For each execution of the 10 current approximation image, app, which is initially set to x, is symme extended by internal function symextend.This function calls padarray, was introduced in Section 3.4.2, to extend app in two dimensions by mirro tended approximation are next convolved with highpass decomposition fii{ hp and downsampled via symconv. This function is described in the follo '  #### You've reached the end of your free preview.

Want to read all 302 pages?

• • •  