mirror of
https://github.com/simon987/wavelib.git
synced 2025-04-19 18:16:44 +00:00
commit : sureshrink error correction
This commit is contained in:
parent
fa68a811af
commit
ee88fece29
@ -248,17 +248,17 @@ void sureshrink(double *signal,int N,char *wname,char *method,char *ext,char *th
|
||||
if(!strcmp(thresh,"hard")) {
|
||||
for(i = 0; i < dwt_len;++i) {
|
||||
if (fabs(wt->output[len+i]) < td) {
|
||||
wt->output[i] = 0;
|
||||
wt->output[len+i] = 0;
|
||||
}
|
||||
}
|
||||
} else if(!strcmp(thresh,"soft")) {
|
||||
for(i = 0; i < dwt_len;++i) {
|
||||
if (fabs(wt->output[len + i]) < td) {
|
||||
wt->output[i] = 0;
|
||||
wt->output[len+i] = 0;
|
||||
} else {
|
||||
sgn = wt->output[len+i] >= 0 ? 1 : -1;
|
||||
temp = sgn * (fabs(wt->output[len+i]) - td);
|
||||
wt->output[i] = temp;
|
||||
wt->output[len+i] = temp;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,6 +13,8 @@ extern "C" {
|
||||
|
||||
void visushrink(double *signal,int N,char *wname,char *method,char *ext,char *thresh,double *denoised);
|
||||
|
||||
void sureshrink(double *signal,int N,char *wname,char *method,char *ext,char *thresh,double *denoised);
|
||||
|
||||
double mad(double *x, int N);
|
||||
|
||||
|
||||
|
@ -39,9 +39,10 @@ int main() {
|
||||
inp[i] = temp[i];
|
||||
}
|
||||
|
||||
visushrink(inp,N,wname,method,ext,thresh,oup);
|
||||
//visushrink(inp,N,wname,method,ext,thresh,oup);
|
||||
sureshrink(inp,N,wname,method,ext,thresh,oup);
|
||||
|
||||
ofp = fopen("denoised.txt", "w");
|
||||
ofp = fopen("denoiseds.txt", "w");
|
||||
|
||||
for(i = 0; i < N;++i) {
|
||||
fprintf(ofp,"%g \n",oup[i]);
|
||||
|
Loading…
x
Reference in New Issue
Block a user