added comments

This commit is contained in:
Nicolas TRAGLIA 2023-03-01 20:09:03 +01:00
parent 4dab61c451
commit e8cff7bdd6
1 changed files with 3 additions and 1 deletions

View File

@ -82,7 +82,7 @@ int main(){
{ {
cv::Mat frame_gray; cv::Mat frame_gray;
cv::cvtColor(frame, frame_gray, cv::COLOR_BGR2GRAY); cv::cvtColor(frame, frame_gray, cv::COLOR_BGR2GRAY);
//cv::imshow("Gray", frame_gray); //Shows frame in greyscale //cv::imshow("Gray", frame_gray); //Shows frame in greyscale, disabled if as comment
std::vector<cv::Rect> faceRectangles; std::vector<cv::Rect> faceRectangles;
faceDetector.detectMultiScale(frame_gray, faceRectangles, 1.1, 3, 0, cv::Size(20,20)); //Detects face faceDetector.detectMultiScale(frame_gray, faceRectangles, 1.1, 3, 0, cv::Size(20,20)); //Detects face
@ -143,6 +143,7 @@ int main(){
// display green FFT // display green FFT
cv::imshow("FFT module green", plotGraph(greenFFTModule, range)); cv::imshow("FFT module green", plotGraph(greenFFTModule, range));
//Find max Value and index of said value from FFT
float maxValue=-1; float maxValue=-1;
int indexValue=0; int indexValue=0;
for(auto i=0.5*(BUFFER_DURATION);i<(4*BUFFER_DURATION);i++) for(auto i=0.5*(BUFFER_DURATION);i<(4*BUFFER_DURATION);i++)
@ -153,6 +154,7 @@ int main(){
indexValue=i; indexValue=i;
} }
} }
//Calculate and print Heart Rate Beat Per Minute
float HRBPM=(indexValue*60.0)/(BUFFER_DURATION); float HRBPM=(indexValue*60.0)/(BUFFER_DURATION);
std::cout<<HRBPM << std::endl; std::cout<<HRBPM << std::endl;
} }