updated w/bugfix + peak finder

This commit is contained in:
NicolasTraglia 2023-03-01 07:59:27 +01:00
parent 4b3a266afa
commit 58d4612738
1 changed files with 19 additions and 3 deletions

22
ppg.cpp
View File

@ -115,7 +115,7 @@ int main(){
cv::meanStdDev(greenSignal, mean, stddev);
for (int l_sample=0; l_sample < FPS*BUFFER_DURATION; l_sample++)
{
greenSignalNormalized.push_back((greenSignal.at<double>(0, l_sample)-mean[0])/stddev[0])
greenSignalNormalized.push_back((greenSignal.at<double>(0, l_sample)-mean[0])/stddev[0]);
}
//This is used in the main function to display the signal
int range[2] = {0, (int)(FPS*BUFFER_DURATION)};
@ -136,7 +136,23 @@ int main(){
}
// display green FFT
cv::imshow("FFT module green", plotGraph(greenFFTModule, range));
std::vector<double> sampleVector{};
for (int i=0; i<greenFFTModule.length();++i)
{
if (greenFFTModule.at(i)>=0.5 && greenFFTModule.at(i)<=4)
{
sampleVector.push_back(greenFFTModule.at(i));
}
}
std::cout << "values in interval: "<<"\n";
for (auto i: sampleVector())
{
std::cout << i << ' '; // will print vector's content
}
//get maximum value of sampleVector and print it
std::cout<<"max frequency: "<<"\n"<<max_element(sampleVector.begin(cloud), sampleVector.end(cloud));
return 0;
}
}
}
}