#include "Worker.h"
#include "ECTrainer.h"
#include "EyeTrack.h"
#include "myOpenCV.h"
#include <Windows.h>
#include <stdio.h>
Worker::Worker(ECTrainer* pEct) : BaseProcess(pEct) {
}
bool Worker::Init() {
return true;
}
bool Worker::MainLoop() {
int64 start = cv::getTickCount();
FILE* fp;
fopen_s(&fp, "log.txt", "w");
printf("time,gazeVx,gazeVy\n");
while (_pEct->IsAppRun()) {
Sleep(0);
if (!_pEct->PEyeTrack()->IsNewGazeV()) continue;
float elapse = (float)(cv::getTickCount() - start) * 1000.F / cv::getTickFrequency();
cv::Point2f gazeV = (_pEct->GetGazeV());
fprintf(fp, "%.1f, %.1f, %.1f\n", elapse, gazeV.x, gazeV.y);
}
fclose(fp);
return true;
}