updated to turn video to grey for face recognition
This commit is contained in:
parent
b120ad221e
commit
7b2b35dfc5
File diff suppressed because it is too large
Load Diff
16
ppg.cpp
16
ppg.cpp
|
|
@ -11,6 +11,7 @@ int DISCARD_DURATION=5;
|
|||
bool isDiscardData=true;
|
||||
int countDiscard=0;
|
||||
|
||||
|
||||
int main(){
|
||||
//Print "PPG algorithm" to terminal
|
||||
//Note to self: std::endl; returns to line in terminal; use it everytime when done printing something.
|
||||
|
|
@ -25,6 +26,13 @@ int main(){
|
|||
return -2;
|
||||
}
|
||||
|
||||
cv::CascadeClassifier faceDetector;
|
||||
if(!faceDetector.load("./haarcascade_frontalface_alt.xml"))
|
||||
{
|
||||
std::cerr<<"[ERROR] Unable to load face cascade"<<std::endl;
|
||||
return -1;
|
||||
};
|
||||
|
||||
while (true)
|
||||
{
|
||||
if(isDiscardData)
|
||||
|
|
@ -49,12 +57,16 @@ int main(){
|
|||
break;
|
||||
}
|
||||
cv::imshow("Color", frame);
|
||||
|
||||
if (cv::waitKey(1000.0/FPS)>=0)
|
||||
{
|
||||
break;
|
||||
|
||||
}
|
||||
|
||||
cv::Mat frame_gray;
|
||||
cv::cvtColor(frame, frame_gray, cv::COLOR_BGR2GRAY);
|
||||
cv::imshow("Gray", frame_gray);
|
||||
std::vector<cv::Rect> faceRectangles;
|
||||
faceDetector.detectMultiScale(frame_gray, faceRectangles, 1.1, 3, 0, cv::Size(20,20));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue