Implémentation de la fonction coef2cont

This commit is contained in:
Guillaume Courrier 2019-11-26 13:45:25 +01:00
parent a600e8e91e
commit 5be8c8533a
3 changed files with 18 additions and 3 deletions

View file

0
rapport/rapport.tex Normal file
View file

View file

@ -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();
//TODO: trouver les bonnes valeurs
int kmin = 0;
int kmax = 2*cmax;
for (auto tf_it = tfd.begin(); tf_it != tfd.end(); ++tf_it) {
//TODO retrouver la formule
//*cont_it = mean + ...;
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);
};