Merge branch 'develop'
This commit is contained in:
commit
00e4b2163e
10
makefile
10
makefile
|
|
@ -1,5 +1,11 @@
|
||||||
all: ppg
|
all: ppg
|
||||||
g++ ppg.o
|
g++ ppg.o -o ppg.exe -lopencv_stitching -lopencv_aruco -lopencv_bgsegm -lopencv_bioinspired -lopencv_ccalib -lopencv_dnn_objdetect -lopencv_dnn_superres -lopencv_dpm -lopencv_highgui -lopencv_face -lopencv_freetype -lopencv_fuzzy -lopencv_hdf -lopencv_hfs -lopencv_img_hash -lopencv_line_descriptor -lopencv_quality -lopencv_reg -lopencv_rgbd -lopencv_saliency -lopencv_shape -lopencv_stereo -lopencv_structured_light -lopencv_phase_unwrapping -lopencv_superres -lopencv_optflow -lopencv_surface_matching -lopencv_tracking -lopencv_datasets -lopencv_text -lopencv_dnn -lopencv_plot -lopencv_ml -lopencv_videostab -lopencv_videoio -lopencv_viz -lopencv_ximgproc -lopencv_video -lopencv_xobjdetect -lopencv_objdetect -lopencv_calib3d -lopencv_imgcodecs -lopencv_features2d -lopencv_flann -lopencv_xphoto -lopencv_photo -lopencv_imgproc -lopencv_core -L/usr/lib/x86_64-linux-gnu/
|
||||||
|
|
||||||
ppg: ppg.cpp
|
ppg: ppg.cpp
|
||||||
g++ -c ppg.cpp
|
g++ -c ppg.cpp -I/usr/include/opencv4/opencv -I/usr/include/opencv4
|
||||||
|
|
||||||
|
#-I/usr/include/opencv4/opencv -I/usr/include/opencv4 is the path to the opencv files
|
||||||
|
clean:
|
||||||
|
rm *.o
|
||||||
|
rm *.exe
|
||||||
|
#removes outdated .o and .exe files
|
||||||
|
|
|
||||||
54
ppg.cpp
54
ppg.cpp
|
|
@ -1,9 +1,61 @@
|
||||||
//C++
|
//C++
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
//include those opencv2 files in our program
|
||||||
|
#include "opencv2/opencv.hpp"
|
||||||
|
#include "opencv2/videoio.hpp"
|
||||||
|
#include "opencv2/highgui.hpp"
|
||||||
|
|
||||||
|
int FPS=30; //FPS variable. FPS is the framerate of your video, aka your recording device's
|
||||||
|
int DISCARD_DURATION=5;
|
||||||
|
bool isDiscardData=true;
|
||||||
|
int countDiscard=0;
|
||||||
|
|
||||||
int main(){
|
int main(){
|
||||||
//Print "PPG algorithm" to terminal
|
//Print "PPG algorithm" to terminal
|
||||||
|
//Note to self: std::endl; returns to line in terminal; use it everytime when done printing something.
|
||||||
std::cout << "PPG algorithm"<< std::endl;
|
std::cout << "PPG algorithm"<< std::endl;
|
||||||
return 0;
|
|
||||||
|
cv::VideoCapture cap;
|
||||||
|
cap.open(0);
|
||||||
|
if (!cap.isOpened())
|
||||||
|
{
|
||||||
|
//Check if we can access the camera
|
||||||
|
std::cerr<<"[ERROR] unable to open camera!"<<std::endl;
|
||||||
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
if(isDiscardData)
|
||||||
|
{
|
||||||
|
countDiscard++;
|
||||||
|
if (countDiscard == DISCARD_DURATION*FPS)
|
||||||
|
{
|
||||||
|
isDiscardData=false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//Create a matrix to store the image from the cam
|
||||||
|
cv::Mat frame;
|
||||||
|
//Wait for a new frame from camera and store it into "frame"
|
||||||
|
cap.read(frame);
|
||||||
|
|
||||||
|
//Check if we succeeded
|
||||||
|
if (frame.empty())
|
||||||
|
{
|
||||||
|
std::cerr<<"[ERROR] Blank frame grabbed"<<std::endl;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
cv::imshow("Color", frame);
|
||||||
|
|
||||||
|
if (cv::waitKey(1000.0/FPS)>=0)
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue