diff --git a/ECTrainer2/ECTrainer.h b/ECTrainer2/ECTrainer.h index d5ccbfa..98731f4 100644 --- a/ECTrainer2/ECTrainer.h +++ b/ECTrainer2/ECTrainer.h @@ -6,8 +6,8 @@ //#include "myOpenCV.h" #define ADDR "192.168.71.50" -//#define EYEDEVICE_GLASS2 -#define EYEDEVICE_NONE +#define EYEDEVICE_GLASS2 +//#define EYEDEVICE_NONE class BaseProcess; class ECTrainerGUI; diff --git a/ECTrainer2/EyeTrack.cpp b/ECTrainer2/EyeTrack.cpp index 487d24b..ff4669a 100644 --- a/ECTrainer2/EyeTrack.cpp +++ b/ECTrainer2/EyeTrack.cpp @@ -2,6 +2,8 @@ #include #include "EyeTrack.h" #include "ECTrainer.h" +#include "KeepAlive.h" +#include "SceneCamera.h" #pragma comment(lib, "ws2_32.lib") #include diff --git a/ECTrainer2/KeepAlive.cpp b/ECTrainer2/KeepAlive.cpp index c109b2d..771a3f5 100644 --- a/ECTrainer2/KeepAlive.cpp +++ b/ECTrainer2/KeepAlive.cpp @@ -3,6 +3,7 @@ #include #include "KeepAlive.h" #include "ECTrainer.h" +#include "myWinUtils.h" // �R���X�g���N�^ KeepAlive::KeepAlive(ECTrainer* pEct) @@ -20,13 +21,13 @@ // Initialize winsock WSADATA wsa; if (WSAStartup(MAKEWORD(2, 2), &wsa) != 0) { - std::cerr << "Initialising Winsock Failed with error Code : " << WSAGetLastError() << std::endl; + mwut::DebugPrintf(_T("Initialising Winsock Failed with error Code : %d\n"), WSAGetLastError()); return false; } // Create socket if ((_socket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP)) == SOCKET_ERROR) { - std::cerr << "Creating socket failed with error code : " << WSAGetLastError() << std::endl; + mwut::DebugPrintf(_T("Creating socket failed with error Code : %d\n"), WSAGetLastError()); return false; } @@ -52,7 +53,7 @@ _count = 0; if (sendto(_socket, message, (int)strlen(message), 0, (struct sockaddr*)&_socketAddr, _socketAddrLen) == SOCKET_ERROR) { - std::cerr << "Keep Alive Data Sent Error" << std::endl; + mwut::DebugPrintf(_T("Keep Alive Data Sent Error\n")); } else { _sent = true; } diff --git a/ECTrainer2/StimConfig.txt b/ECTrainer2/StimConfig.txt index e35348e..e1b539e 100644 --- a/ECTrainer2/StimConfig.txt +++ b/ECTrainer2/StimConfig.txt @@ -1 +1 @@ -2,../movies/visit01_004.avi,5,../movies/visit01_004.csv +2,../movies/visit01_004.avi,30,../movies/visit01_004.csv diff --git a/ECTrainer2/Stimulus.cpp b/ECTrainer2/Stimulus.cpp index 00b1621..24abb77 100644 --- a/ECTrainer2/Stimulus.cpp +++ b/ECTrainer2/Stimulus.cpp @@ -44,7 +44,9 @@ bool Stimulus::Routine() { if (_StimNo >= 0) { - if (_StimTimer.Elapse() / 1000. > (double)_StimInfoSet[_StimNo].dulation) { + double eTime = _StimTimer.Elapse(); + // �h���؂�ւ��^�C���L�[�p�[ + if (eTime / 1000. > (double)_StimInfoSet[_StimNo].dulation) { if (_StimInfoSet[_StimNo].type == 2) { _Movie.Put(L"STOP"); mwut::DebugPrintf(L"movie put stop.\n"); @@ -56,6 +58,14 @@ ((BaseProcess*)_pEct->PWorker())->Tell(ECTMSG::EXP_END); } } + + // �����ǂݍ��� + if (_StimInfoSet[_StimNo].type == 2 && _cap.isOpened()) { + _cap.set(cv::CAP_PROP_POS_MSEC, eTime); + cv::Mat frame; + _cap >> frame; + _Display.Put(frame); + } } Sleep(0); @@ -104,6 +114,8 @@ _Display.Put(cv::imread(_StimInfoSet[newStimNo].filename)); } else { _Movie.Put(mwut::Multi2Wide(_StimInfoSet[newStimNo].filename)); + if (_cap.isOpened()) _cap.release(); + _cap.open(_StimInfoSet[newStimNo].filename); } _StimTimer.Reset(); @@ -125,7 +137,7 @@ std::vector elems; return elems; } - if (eTime < 0) eTime = (float)_StimTimer.Elapse(); + if (eTime < 0) eTime = (float)_StimTimer.Elapse() / 1000.F; return _pMovieObject->GetElements(eTime); } diff --git a/ECTrainer2/Stimulus.h b/ECTrainer2/Stimulus.h index d129832..a6ee0ef 100644 --- a/ECTrainer2/Stimulus.h +++ b/ECTrainer2/Stimulus.h @@ -37,6 +37,7 @@ mwut::HPTimer _StimTimer; // �h���񎦃^�C�}�[ RingBuffer _Display; // �\���摜 RingBuffer _Movie; // ������ + cv::VideoCapture _cap; // ����I�u�W�F�N�g // �h����ݒ� bool SetStimulus(int newStimNo);