Browse Source

Implémentation de la fonction coef2cont

master
Guillaume Courrier 6 years ago
parent
commit
5be8c8533a
  1. 0
      presentation/presentation.tex
  2. 0
      rapport/rapport.tex
  3. 23
      tests/src/math.hpp

0
presentation/presentation.tex

0
rapport/rapport.tex

23
tests/src/math.hpp

@ -33,11 +33,17 @@ namespace math {
return complex(res.real()/sig.size(), res.imag()/sig.size());
};
//TODO: implémenter la fonction
csignal diff(const csignal& input, complex mean) {
return csignal();
}
//TODO implémenter la fft
csignal fft_rec(const csignal& input) {
int size = input.size();
if (size == 1) {
//TODO: que faire dans ce cas ?
return csignal();
} else {
csignal odd;
@ -79,10 +85,18 @@ namespace math {
contour cont;
auto tf_it = tfd.begin();
auto cont_it = cont.begin();
for (auto tf_it = tfd.begin(); tf_it != tfd.end(); ++tf_it) {
//TODO retrouver la formule
//*cont_it = mean + ...;
//TODO: trouver les bonnes valeurs
int kmin = 0;
int kmax = 2*cmax;
for (int m=0; m<tfd.size(); ++m) {
//TODO: retrouver la formule
complex sum;
for (int k=kmin; k<kmax; ++k) {
sum += tfd[k]*std::exp(complex(0, 2*pi()*k*m/tfd.size()));
}
complex zm = mean + sum;
*(cont_it++) = cv::Point(zm.real(), zm.imag());
}
return cont;
};
@ -91,6 +105,7 @@ namespace math {
contour res;
csignal z = cont2sig(cont);
complex zm = mean(z);
//TODO: fft(diff(z, zm));
csignal tfd = fft(z);
return coef2cont(tfd, zm, 0, cmax);
};

Loading…
Cancel
Save