updated w/bugfix + peak finder
This commit is contained in:
parent
4b3a266afa
commit
58d4612738
22
ppg.cpp
22
ppg.cpp
|
|
@ -115,7 +115,7 @@ int main(){
|
||||||
cv::meanStdDev(greenSignal, mean, stddev);
|
cv::meanStdDev(greenSignal, mean, stddev);
|
||||||
for (int l_sample=0; l_sample < FPS*BUFFER_DURATION; l_sample++)
|
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
|
//This is used in the main function to display the signal
|
||||||
int range[2] = {0, (int)(FPS*BUFFER_DURATION)};
|
int range[2] = {0, (int)(FPS*BUFFER_DURATION)};
|
||||||
|
|
@ -136,7 +136,23 @@ int main(){
|
||||||
}
|
}
|
||||||
// display green FFT
|
// display green FFT
|
||||||
cv::imshow("FFT module green", plotGraph(greenFFTModule, range));
|
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;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Loading…
Reference in New Issue