## how to apply DWT on a image and to extract energy from all the coeffecients?

Asked by Benitta glara

### Benitta glara (view profile)

on 5 Oct 2012

how to apply DWT on a image and to extract energy from all the coeffecients?

## Products

No products are associated with this question.

### Wayne King (view profile)

Answer by Wayne King

### Wayne King (view profile)

on 5 Oct 2012
Edited by Wayne King

### Wayne King (view profile)

on 5 Oct 2012

You can obtain a measure of relative contribution (percentage of energy in each of the detail images and the approximation image) with this:

```load woman;
dwtmode('per');
[C,S] = wavedec(X,1,'db4');
TE = norm(C,2)^2;
[ca,ch,cv,cd] = dwt2(X,'db4','mode','per');
app_per = 100*(sum(abs(ca(:)).^2))/TE;
horiz_per = 100*(sum(abs(ch(:)).^2))/TE;
vert_per = 100*(sum(abs(cv(:)).^2))/TE;
diag_per = 100*(sum(abs(cd(:)).^2))/TE;
```

#### Join the 15-year community celebration.

Play games and win prizes!

MATLAB and Simulink resources for Arduino, LEGO, and Raspberry Pi