2-D detail coefficients


D = detcoef2(O,C,S,N)


detcoef2 is a two-dimensional wavelet analysis function.

D = detcoef2(O,C,S,N) extracts from the wavelet decomposition structure [C,S] the horizontal, vertical, or diagonal detail coefficients for O = 'h'(or 'v' or 'd', respectively), at level N, where N must be an integer such that 1 N size(S,1)-2. See wavedec2 for more information on C and S.

[H,V,D] = detcoef2('all',C,S,N) returns the horizontal H, vertical V, and diagonal D detail coefficients at level N.

D = detcoef2('compact',C,S,N) returns the detail coefficients at level N, stored row-wise.

detcoef2('a',C,S,N) is equivalent to detcoef2('all',C,S,N).

detcoef2('c',C,S,N) is equivalent to detcoef2('compact',C,S,N).


% The current extension mode is zero-padding (see dwtmode).

% Load original image. 
load woman;
% X contains the loaded image.

% Perform decomposition at level 2 
% of X using db1.
[c,s] = wavedec2(X,2,'db1');
sizex = size(X)
sizex =
    256    256

sizec = size(c)
sizec =
    1    65536

val_s = s 
val_s =
     64     64
     64     64
    128    128
    256    256

% Extract details coefficients at level 2 
% in each orientation, from wavelet decomposition 
% structure [c,s]. 
[chd2,cvd2,cdd2] = detcoef2('all',c,s,2); 
sizecd2 = size(chd2)
sizecd2 =
     64     64

% Extract details coefficients at level 1 
% in each orientation, from wavelet decomposition 
% structure [c,s]. 
[chd1,cvd1,cdd1] = detcoef2('all',c,s,1); 
sizecd1 = size(chd1)
sizecd1 =
    128    128

More About

expand all


If C and S are obtained from an indexed image analysis or a truecolor image analysis, D is an m-by-n matrix or an m-by-n-by-3 array, respectively.

For more information on image formats, see the image and imfinfo reference pages.

Introduced before R2006a

Was this topic helpful?