Fun from cli and host as websocket

This commit is contained in:
Ruben 2017-11-16 17:48:04 +01:00
parent f4ac3cee0a
commit 019498ea1f
1 changed files with 10 additions and 4 deletions

View File

@ -16,8 +16,10 @@
#include "PlottingImageListener.hpp" #include "PlottingImageListener.hpp"
#include "StatusListener.hpp" #include "StatusListener.hpp"
using namespace std; using namespace std;
using namespace affdex; using namespace affdex;
using namespace cv;
std::string getAsJson(int framenr, const std::map<FaceId, Face> faces, const double timeStamp) std::string getAsJson(int framenr, const std::map<FaceId, Face> faces, const double timeStamp)
@ -35,6 +37,7 @@ std::string getAsJson(int framenr, const std::map<FaceId, Face> faces, const dou
if(i > 0) { ss << ","; } if(i > 0) { ss << ","; }
i++; i++;
ss << "{"; ss << "{";
@ -231,12 +234,14 @@ int main(int argsc, char ** argsv)
int framenr = 0; int framenr = 0;
do{ do{
cv::Mat img; /* cv::Mat img;
if (!webcam.read(img)) //Capture an image from the camera if (!webcam.read(img)) //Capture an image from the camera
{ {
std::cerr << "Failed to read frame from webcam! " << std::endl; std::cerr << "Failed to read frame from webcam! " << std::endl;
break; break;
} }*/
std::string infile = "/home/crowd/capt0000.jpg";
cv::Mat img = imread(infile, 1);
//~ imread(img); //~ imread(img);
@ -249,10 +254,11 @@ int main(int argsc, char ** argsv)
capture_fps = 1.0f / (seconds - last_timestamp); capture_fps = 1.0f / (seconds - last_timestamp);
last_timestamp = seconds; last_timestamp = seconds;
frameDetector->process(f); //Pass the frame to detector frameDetector->process(f); //Pass the frame to detector
std::cerr << "test1";
// For each frame processed // For each frame processed
if (listenPtr->getDataSize() > 0) if (listenPtr->getDataSize() > 0)
{ {
std::cerr << "test2";
framenr++; framenr++;
std::pair<Frame, std::map<FaceId, Face> > dataPoint = listenPtr->getData(); std::pair<Frame, std::map<FaceId, Face> > dataPoint = listenPtr->getData();
@ -287,7 +293,7 @@ int main(int argsc, char ** argsv)
} }
break;
} }