Implémentation de la fonction coef2cont
This commit is contained in:
parent
a600e8e91e
commit
5be8c8533a
3 changed files with 18 additions and 3 deletions
0
presentation/presentation.tex
Normal file
0
presentation/presentation.tex
Normal file
0
rapport/rapport.tex
Normal file
0
rapport/rapport.tex
Normal file
|
@ -33,11 +33,17 @@ namespace math {
|
||||||
return complex(res.real()/sig.size(), res.imag()/sig.size());
|
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
|
//TODO implémenter la fft
|
||||||
csignal fft_rec(const csignal& input) {
|
csignal fft_rec(const csignal& input) {
|
||||||
int size = input.size();
|
int size = input.size();
|
||||||
|
|
||||||
if (size == 1) {
|
if (size == 1) {
|
||||||
|
//TODO: que faire dans ce cas ?
|
||||||
return csignal();
|
return csignal();
|
||||||
} else {
|
} else {
|
||||||
csignal odd;
|
csignal odd;
|
||||||
|
@ -79,10 +85,18 @@ namespace math {
|
||||||
contour cont;
|
contour cont;
|
||||||
auto tf_it = tfd.begin();
|
auto tf_it = tfd.begin();
|
||||||
auto cont_it = cont.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) {
|
for (int m=0; m<tfd.size(); ++m) {
|
||||||
//TODO retrouver la formule
|
//TODO: retrouver la formule
|
||||||
//*cont_it = mean + ...;
|
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;
|
return cont;
|
||||||
};
|
};
|
||||||
|
@ -91,6 +105,7 @@ namespace math {
|
||||||
contour res;
|
contour res;
|
||||||
csignal z = cont2sig(cont);
|
csignal z = cont2sig(cont);
|
||||||
complex zm = mean(z);
|
complex zm = mean(z);
|
||||||
|
//TODO: fft(diff(z, zm));
|
||||||
csignal tfd = fft(z);
|
csignal tfd = fft(z);
|
||||||
return coef2cont(tfd, zm, 0, cmax);
|
return coef2cont(tfd, zm, 0, cmax);
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue