step 4
This commit is contained in:
parent
e515e8f5fa
commit
76f2e9de06
38
ppg.cpp
38
ppg.cpp
|
|
@ -2,7 +2,12 @@
|
||||||
#include "opencv2/videoio.hpp"
|
#include "opencv2/videoio.hpp"
|
||||||
#include "opencv2/highgui.hpp"
|
#include "opencv2/highgui.hpp"
|
||||||
|
|
||||||
const int FPS = 15;
|
const int FPS = 30;
|
||||||
|
|
||||||
|
|
||||||
|
bool isDiscardData = true;
|
||||||
|
int countDiscard = 0;
|
||||||
|
const int DISCARD_DURATION = 10;
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
cv::VideoCapture cap;
|
cv::VideoCapture cap;
|
||||||
|
|
@ -14,19 +19,22 @@ int main() {
|
||||||
}
|
}
|
||||||
|
|
||||||
while (true) {
|
while (true) {
|
||||||
// create a matrix to store the image from the cam
|
if(isDiscardData){
|
||||||
cv::Mat frame;
|
countDiscard++;
|
||||||
// wait for a new frame from camera and store it into 'frame'
|
if(countDiscard == DISCARD_DURATION*FPS)
|
||||||
cap.read(frame);
|
isDiscardData = false;
|
||||||
// check if we succeeded
|
}
|
||||||
if (frame.empty()) {
|
else{
|
||||||
std::cerr << "[ERROR] blank frame grabbed" << std::endl;
|
cv::Mat frame;
|
||||||
break;
|
cap.read(frame);
|
||||||
|
if (frame.empty()) {
|
||||||
|
std::cerr << "[ERROR] blank frame grabbed" << std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cv::imshow("Color", frame);
|
||||||
|
if (cv::waitKey(1000.0 / FPS) >= 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
cv::imshow("Color", frame);
|
return 0;
|
||||||
if (cv::waitKey(1000.0 / FPS) >= 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue