mirror of
https://github.com/simon987/wavelib.git
synced 2025-12-16 12:19:01 +00:00
commit : visushrink example added
This commit is contained in:
@@ -5,8 +5,51 @@
|
||||
#include "../header/denoise.h"
|
||||
|
||||
int main() {
|
||||
double x[10] = {1.2,4.3,-0.7,90,4.7,123.5,-9.5,-100,0.0,89};
|
||||
// gcc -Wall -I../header -L../Bin denoisetest.c -o denoise -ldenoiselib -lwavelib -lm
|
||||
double *inp,*oup;
|
||||
int i,N;
|
||||
FILE *ifp,*ofp;
|
||||
double temp[2400];
|
||||
|
||||
printf("%g \n",mad(x,10));
|
||||
char *wname = "sym8";
|
||||
char *method = "dwt";
|
||||
char *ext = "sym";
|
||||
char *thresh = "soft";
|
||||
|
||||
ifp = fopen("noisyheavisine.txt", "r");
|
||||
i = 0;
|
||||
if (!ifp) {
|
||||
printf("Cannot Open File");
|
||||
exit(100);
|
||||
}
|
||||
|
||||
while (!feof(ifp)) {
|
||||
fscanf(ifp, "%lf \n", &temp[i]);
|
||||
i++;
|
||||
}
|
||||
|
||||
fclose(ifp);
|
||||
|
||||
N = i;
|
||||
|
||||
inp = (double*)malloc(sizeof(double)* N);
|
||||
oup = (double*)malloc(sizeof(double)* N);
|
||||
|
||||
for(i = 0; i < N;++i) {
|
||||
inp[i] = temp[i];
|
||||
}
|
||||
|
||||
visushrink(inp,N,wname,method,ext,thresh,oup);
|
||||
|
||||
ofp = fopen("denoised.txt", "w");
|
||||
|
||||
for(i = 0; i < N;++i) {
|
||||
fprintf(ofp,"%g \n",oup[i]);
|
||||
}
|
||||
|
||||
fclose(ofp);
|
||||
|
||||
free(inp);
|
||||
free(oup);
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user