Use PhotoDetector for more stable processing
This commit is contained in:
parent
7445907e56
commit
ff4ccd7410
1 changed files with 6 additions and 3 deletions
|
@ -10,6 +10,7 @@
|
||||||
#include "Frame.h"
|
#include "Frame.h"
|
||||||
#include "Face.h"
|
#include "Face.h"
|
||||||
#include "FrameDetector.h"
|
#include "FrameDetector.h"
|
||||||
|
#include "PhotoDetector.h"
|
||||||
#include "AffdexException.h"
|
#include "AffdexException.h"
|
||||||
|
|
||||||
#include "AFaceListener.hpp"
|
#include "AFaceListener.hpp"
|
||||||
|
@ -129,7 +130,7 @@ int main(int argsc, char ** argsv)
|
||||||
namespace po = boost::program_options; // abbreviate namespace
|
namespace po = boost::program_options; // abbreviate namespace
|
||||||
|
|
||||||
std::cerr << "Hit ESCAPE key to exit app.." << endl;
|
std::cerr << "Hit ESCAPE key to exit app.." << endl;
|
||||||
shared_ptr<FrameDetector> frameDetector;
|
shared_ptr<PhotoDetector> frameDetector;
|
||||||
|
|
||||||
try{
|
try{
|
||||||
|
|
||||||
|
@ -208,7 +209,7 @@ int main(int argsc, char ** argsv)
|
||||||
shared_ptr<FaceListener> faceListenPtr(new AFaceListener());
|
shared_ptr<FaceListener> faceListenPtr(new AFaceListener());
|
||||||
shared_ptr<PlottingImageListener> listenPtr(new PlottingImageListener(csvFileStream, draw_display)); // Instanciate the ImageListener class
|
shared_ptr<PlottingImageListener> listenPtr(new PlottingImageListener(csvFileStream, draw_display)); // Instanciate the ImageListener class
|
||||||
shared_ptr<StatusListener> videoListenPtr(new StatusListener());
|
shared_ptr<StatusListener> videoListenPtr(new StatusListener());
|
||||||
frameDetector = make_shared<FrameDetector>(buffer_length, process_framerate, nFaces, (affdex::FaceDetectorMode) faceDetectorMode); // Init the FrameDetector Class
|
frameDetector = make_shared<PhotoDetector>(nFaces, (affdex::FaceDetectorMode) faceDetectorMode); // Init the FrameDetector Class
|
||||||
|
|
||||||
//Initialize detectors
|
//Initialize detectors
|
||||||
frameDetector->setDetectAllEmotions(true);
|
frameDetector->setDetectAllEmotions(true);
|
||||||
|
@ -243,6 +244,7 @@ int main(int argsc, char ** argsv)
|
||||||
int frameNrIn = 1;
|
int frameNrIn = 1;
|
||||||
int frameNrOut = 1;
|
int frameNrOut = 1;
|
||||||
std::time_t lastImgUpdate(0);
|
std::time_t lastImgUpdate(0);
|
||||||
|
int seconds = 1;
|
||||||
while(true){ //(cv::waitKey(20) != -1);
|
while(true){ //(cv::waitKey(20) != -1);
|
||||||
char buff[100];
|
char buff[100];
|
||||||
snprintf(buff, sizeof(buff), "frame%06d.jpg", frameNrIn);
|
snprintf(buff, sizeof(buff), "frame%06d.jpg", frameNrIn);
|
||||||
|
@ -264,10 +266,11 @@ int main(int argsc, char ** argsv)
|
||||||
|
|
||||||
//Calculate the Image timestamp and the capture frame rate;
|
//Calculate the Image timestamp and the capture frame rate;
|
||||||
const auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start_time);
|
const auto milliseconds = std::chrono::duration_cast<std::chrono::milliseconds>(std::chrono::system_clock::now() - start_time);
|
||||||
const double seconds = milliseconds.count() / 1000.f;
|
//~ const double seconds = milliseconds.count() / 1000.f;
|
||||||
|
|
||||||
// Create a frame
|
// Create a frame
|
||||||
Frame f(img.size().width, img.size().height, img.data, Frame::COLOR_FORMAT::BGR, seconds);
|
Frame f(img.size().width, img.size().height, img.data, Frame::COLOR_FORMAT::BGR, seconds);
|
||||||
|
seconds++;
|
||||||
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
|
||||||
|
|
Loading…
Reference in a new issue