Average Green Value Found in the ROI
This commit is contained in:
parent
e9ae38eae7
commit
f76e338c9f
17
ppg.cpp
17
ppg.cpp
|
|
@ -8,6 +8,7 @@ const int FPS = 30;
|
|||
bool isDiscardData = true;
|
||||
int countDiscard = 0;
|
||||
const int DISCARD_DURATION = 5;
|
||||
const int BUFFER_DURATION = 30;
|
||||
|
||||
int main()
|
||||
{
|
||||
|
|
@ -62,6 +63,22 @@ int main()
|
|||
cv::imshow("Your Face PLS", frame);
|
||||
if (cv::waitKey(1000.0/FPS) >= 0)
|
||||
break;
|
||||
|
||||
cv::Mat frame_forehead = frame(foreheadROI);
|
||||
cv::Scalar avg_forehead = mean(frame_forehead);
|
||||
|
||||
bool isBufferFull = false;
|
||||
int sampleIdBuffer = 0;
|
||||
cv::Mat greenSignal(1, FPS*BUFFER_DURATION, CV_64F);
|
||||
if (!isBufferFull)
|
||||
{
|
||||
greenSignal.at<double>(0, sampleIdBuffer) = avg_forehead[1] ;
|
||||
sampleIdBuffer++;
|
||||
if (sampleIdBuffer == FPS*BUFFER_DURATION)
|
||||
{
|
||||
isBufferFull = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
|
|
|
|||
Loading…
Reference in New Issue