Added comments

This commit is contained in:
Nicolas TRAGLIA 2023-02-27 15:58:59 +01:00
parent 8c97a5a416
commit aafe28c0e0
1 changed files with 9 additions and 9 deletions

14
ppg.cpp
View File

@ -27,7 +27,7 @@ int main(){
}
cv::CascadeClassifier faceDetector;
if(!faceDetector.load("./haarcascade_frontalface_alt.xml"))
if(!faceDetector.load("./haarcascade_frontalface_alt.xml"))//Testing to see if cascade_frontalface.xml is available (necessary for the program to work)
{
std::cerr<<"[ERROR] Unable to load face cascade"<<std::endl;
return -1;
@ -35,7 +35,7 @@ int main(){
while (true)
{
if(isDiscardData)
if(isDiscardData) //This function delays the beginning of the analysis of the data
{
countDiscard++;
if (countDiscard == DISCARD_DURATION*FPS)
@ -51,22 +51,22 @@ int main(){
cap.read(frame);
//Check if we succeeded
if (frame.empty())
if (frame.empty()) //If the camera records a blank frame, returns an error.
{
std::cerr<<"[ERROR] Blank frame grabbed"<<std::endl;
break;
}
cv::imshow("Color", frame);
if (cv::waitKey(1000.0/FPS)>=0)
cv::imshow("Color", frame); //shows the colored frame
if (cv::waitKey(1000.0/FPS)>=0) //Stops after 1000/FPS frames
{
break;
}
cv::Mat frame_gray;
cv::cvtColor(frame, frame_gray, cv::COLOR_BGR2GRAY);
cv::imshow("Gray", frame_gray);
cv::imshow("Gray", frame_gray); //Shows frame in greyscale
std::vector<cv::Rect> faceRectangles;
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)); //Detects face
}
}
}