This commit is contained in:
Estevan BIAU-LOYER 2023-02-24 12:23:20 +01:00
parent fd6fd3202c
commit 6469556d37
1 changed files with 26 additions and 11 deletions

37
ppg.cpp
View File

@ -4,7 +4,8 @@
#include "opencv2/highgui.hpp"
#define FPS 30.0
bool isDiscardData = true;
int countDiscard = 0;
int main(){
std::cout<<"PPG, j'adore gitbash même si avec github desktop c'est mieux"<< std::endl;
cv::VideoCapture cap;
@ -16,21 +17,35 @@ int main(){
}
while (true)
{
// create a matrix to store the image from the cam
cv::Mat frame;
// wait for a new frame from camera and store it into 'frame'
cap.read(frame);
// check if we succeeded
if (frame.empty())
if (isDiscardData)
{
std::cerr << "[ERROR] blank frame grabbed" << std::endl;
break;
countDiscard++;
std::cout <<"countDiscard= " << countDiscard<< std::endl;
if (countDiscard == 10*FPS)
isDiscardData = false;
}
else
{
// create a matrix to store the image from the cam
cv::Mat frame;
// wait for a new frame from camera and store it into 'frame'
cap.read(frame);
// check if we succeeded
if (frame.empty())
{
std::cerr << "[ERROR] blank frame grabbed" << std::endl;
break;
}
cv::imshow("Color", frame);
}
cv::imshow("Color", frame);
if (cv::waitKey(1000.0/FPS) >= 0)
{
break;
}
}
return 0;}
return 0;
}