Files
wavelib/test/denoisetest.c

58 lines
1.0 KiB
C
Raw Normal View History

2017-08-07 06:40:11 +05:30
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <math.h>
#include "../header/denoise.h"
int main() {
// gcc -Wall -I../header -L../Bin denoisetest.c -o denoise -lwauxlib -lwavelib -lm
2017-08-07 18:35:23 +05:30
double *inp,*oup;
2017-08-12 17:20:25 +05:30
int i,N,J;
2017-08-07 18:35:23 +05:30
FILE *ifp,*ofp;
double temp[2400];
2017-08-07 06:40:11 +05:30
2017-08-07 18:35:23 +05:30
char *wname = "sym8";
char *method = "swt";
2017-08-07 18:35:23 +05:30
char *ext = "sym";
char *thresh = "soft";
2017-08-12 17:20:25 +05:30
ifp = fopen("noisybumps.txt", "r");
2017-08-07 18:35:23 +05:30
i = 0;
if (!ifp) {
printf("Cannot Open File");
exit(100);
}
while (!feof(ifp)) {
fscanf(ifp, "%lf \n", &temp[i]);
i++;
}
fclose(ifp);
N = i;
J = 6;
2017-08-07 18:35:23 +05:30
inp = (double*)malloc(sizeof(double)* N);
oup = (double*)malloc(sizeof(double)* N);
for(i = 0; i < N;++i) {
inp[i] = temp[i];
}
2017-08-09 04:50:41 +05:30
//visushrink(inp,N,wname,method,ext,thresh,oup);
2017-08-11 16:21:33 +05:30
sureshrink(inp,N,J,wname,method,ext,thresh,oup);
2017-08-07 18:35:23 +05:30
2017-08-09 04:50:41 +05:30
ofp = fopen("denoiseds.txt", "w");
2017-08-07 18:35:23 +05:30
for(i = 0; i < N;++i) {
fprintf(ofp,"%g \n",oup[i]);
}
fclose(ofp);
free(inp);
free(oup);
2017-08-07 06:40:11 +05:30
return 0;
}