This commit is contained in:
Estevan BIAU-LOYER 2023-03-02 00:26:15 +01:00
parent c1f23e57e5
commit d120d0242a
1 changed files with 0 additions and 31 deletions

31
ppg.cpp
View File

@ -6,9 +6,6 @@
#define FPS 30.0 #define FPS 30.0
bool isDiscardData = true; bool isDiscardData = true;
int countDiscard = 0; int countDiscard = 0;
<<<<<<< HEAD
int main(){
=======
const double nyquistFreq = FPS / 2.0; const double nyquistFreq = FPS / 2.0;
template <typename T> template <typename T>
cv::Mat plotGraph(std::vector<T>& vals, int YRange[2]) cv::Mat plotGraph(std::vector<T>& vals, int YRange[2])
@ -31,7 +28,6 @@ int main(){
int sampleIdBuffer = 0; int sampleIdBuffer = 0;
int BUFFER_DURATION= 10; int BUFFER_DURATION= 10;
>>>>>>> Estevan
std::cout<<"PPG, j'adore gitbash même si avec github desktop c'est mieux"<< std::endl; std::cout<<"PPG, j'adore gitbash même si avec github desktop c'est mieux"<< std::endl;
cv::VideoCapture cap; cv::VideoCapture cap;
cap.open(0); cap.open(0);
@ -40,10 +36,6 @@ int main(){
std::cerr << "[ERROR] Unable to open camera!" << std::endl; std::cerr << "[ERROR] Unable to open camera!" << std::endl;
return -2; return -2;
} }
<<<<<<< HEAD
while (true)
{
=======
cv::CascadeClassifier faceDetector; cv::CascadeClassifier faceDetector;
if( !faceDetector.load("./haarcascade_frontalface_alt.xml")) if( !faceDetector.load("./haarcascade_frontalface_alt.xml"))
{ {
@ -57,28 +49,19 @@ int main(){
{ {
break; break;
} }
>>>>>>> Estevan
if (isDiscardData) if (isDiscardData)
{ {
countDiscard++; countDiscard++;
std::cout <<"countDiscard= " << countDiscard<< std::endl; std::cout <<"countDiscard= " << countDiscard<< std::endl;
<<<<<<< HEAD
if (countDiscard == 10*FPS)
=======
if (countDiscard == 1*FPS) if (countDiscard == 1*FPS)
>>>>>>> Estevan
isDiscardData = false; isDiscardData = false;
} }
else else
{ {
// create a matrix to store the image from the cam // create a matrix to store the image from the cam
<<<<<<< HEAD
cv::Mat frame;
=======
cv::Mat frame, frame_gray; cv::Mat frame, frame_gray;
bool isBufferFull = false; bool isBufferFull = false;
>>>>>>> Estevan
// wait for a new frame from camera and store it into 'frame' // wait for a new frame from camera and store it into 'frame'
cap.read(frame); cap.read(frame);
// check if we succeeded // check if we succeeded
@ -87,19 +70,6 @@ int main(){
std::cerr << "[ERROR] blank frame grabbed" << std::endl; std::cerr << "[ERROR] blank frame grabbed" << std::endl;
break; break;
} }
<<<<<<< HEAD
cv::imshow("Color", frame);
}
if (cv::waitKey(1000.0/FPS) >= 0)
{
break;
}
}
return 0;
}
=======
std::vector<cv::Rect> faceRectangles; std::vector<cv::Rect> faceRectangles;
cvtColor(frame, frame_gray, cv::COLOR_BGR2GRAY); cvtColor(frame, frame_gray, cv::COLOR_BGR2GRAY);
faceDetector.detectMultiScale(frame_gray, faceRectangles, 1.1, 3, 0, cv::Size(20, 20)); faceDetector.detectMultiScale(frame_gray, faceRectangles, 1.1, 3, 0, cv::Size(20, 20));
@ -186,5 +156,4 @@ int main(){
return 0; return 0;
} }
>>>>>>> Estevan