You are on page 1of 2

FYP Group ID: 2

FYP Task: 29th April, 2012


Thresholding:
Thresholding can be done by two methods: hard threshold rule or soft threshold rule. In hard thresholding, the value is either set to zero if its absolute is less than or equal to the threshold or retained if its absolute is greater than the threshold. Similarly, in soft thresholding, the value is set to zero if its absolute is below threshold. However, the above threshold case is different. The following rules are applied when the absolute value is more than the threshold: When the value (z) is more than the threshold (t), then t is subtracted from that value (z) When the value (z) is less than the negative threshold (t), then t is added to that value (z)

We add or subtract the threshold to the value to bring the value closer to the threshold level.

Code for soft thresholding:


T=3; if abs(z)<=t z=0; else if z>=0 z=z-t; else z=z+t; end; end; % threshold already calculated in SPIHT main encode: line 35 % threshold level defined (for example) % zero state i.e. when value is below threshold, % then value is set to zero. % when absolute value is above threshold % if value is +ve, then threshold subtracted % if value is -ve, then threshold added to it

Testing the coding to check if its correct by assuming different values of z:

FYP Group ID: 2

Incorporating the soft thresholding code in the main-encode MATLAB file: (changes done between lines 55 and 74 for soft thresholding)

You might also like