diff --git a/ECTrainer2/ECTrainer.cpp b/ECTrainer2/ECTrainer.cpp index a37b28e..025a60a 100644 --- a/ECTrainer2/ECTrainer.cpp +++ b/ECTrainer2/ECTrainer.cpp @@ -80,27 +80,27 @@ // �L�����u���[�V�����J�n void ECTrainer::CalibStart() { - _pStimulus->SetStimulus(Stimulus::STIM::CALIB); + _pStimulus->SetPage(Stimulus::PAGES::CALIB); _pTobiiREST->Start(); } // �L�����u���[�V�������ʕ\�� int ECTrainer::CheckCalibResult() { int res = _CalibResult; - if (res > 0) _pStimulus->SetStimulus(Stimulus::STIM::CALIB_COMPLETE); - if (res < 0) _pStimulus->SetStimulus(Stimulus::STIM::CALIB_FAILED); + if (res > 0) _pStimulus->SetPage(Stimulus::PAGES::CALIB_COMPLETE); + if (res < 0) _pStimulus->SetPage(Stimulus::PAGES::CALIB_FAILED); _CalibResult = 0; return res; } // �J�n void ECTrainer::Start() { - _pStimulus->SetStimulus(Stimulus::STIM::START); + _pStimulus->SetPage(Stimulus::PAGES::START); } // ���� void ECTrainer::Next() { - _pStimulus->SetStimulus(Stimulus::STIM::NEXT); + _pStimulus->SetPage(Stimulus::PAGES::NEXT); } // ����摜�o�b�t�@�ɉ摜��ݒ� @@ -142,12 +142,14 @@ // �E�ڂ̈ʒu�擾 cv::Point2f ECTrainer::GetEyeR() { - return _pStimulus->GetEyeR(); + //return _pStimulus->GetEyeR(); + return cv::Point2f(0.5, 0.5); } // �E�ڂ̈ʒu�擾 cv::Point2f ECTrainer::GetEyeL() { - return _pStimulus->GetEyeL(); + //return _pStimulus->GetEyeL(); + return cv::Point2f(0.5, 0.5); } // �o�b�e���[�c�ʎ擾 diff --git a/ECTrainer2/StimData.txt b/ECTrainer2/StimData.txt index edb50ac..f7dde49 100644 --- a/ECTrainer2/StimData.txt +++ b/ECTrainer2/StimData.txt @@ -1,3 +1,4 @@ -../images/illust.jpg 0.46 0.43 0.55 0.43 -../images/lena.jpg 0.49 0.45 0.57 0.45 -../images/other.jpg 0.52 0.43 0.67 0.40 +1 ../images/LookNose.jpg 5 _ 0 +2 ../movies/test1_0525.avi 30 ../movies/test1.csv 2 +1 ../images/LookEyes.jpg 5 _ 0 +2 ../movies/test0421.avi 30 ../movies/test0421.csv 1 diff --git a/ECTrainer2/Stimulus.cpp b/ECTrainer2/Stimulus.cpp index ab19c96..4399514 100644 --- a/ECTrainer2/Stimulus.cpp +++ b/ECTrainer2/Stimulus.cpp @@ -17,8 +17,7 @@ // ������ bool Stimulus::Init() { - SetStimulus(STIM::OPENING); - //_DispBuffer = cv::imread(OPENING_FILE); + SetPage(PAGES::OPENING); std::ifstream ifs(DATA_FILE); if (!ifs) @@ -27,10 +26,11 @@ return false; } while (!ifs.eof()) { - StimImage st; - ifs >> st.filename >> st.eyes[0].x >> st.eyes[0].y >> st.eyes[1].x >> st.eyes[1].y; - std::cout << st.filename << st.eyes[0] << st.eyes[1] << std::endl; - if (st.filename.size() > 0) _StimImages.push_back(st); + StimInfo st; + ifs >> st.type >> st.filename >> st.dulation >> st.csvfile >> st.target; + std::cout << st.type << "," << st.filename << "," << st.dulation << "," + << st.csvfile << "," << st.target << std::endl; + if (st.type > 0 && st.filename.size() > 0) _StimInfoSet.push_back(st); } return true; @@ -48,35 +48,35 @@ } // �h���摜�\�� -void Stimulus::SetStimulus(STIM st) { +void Stimulus::SetPage(PAGES st) { switch (st) { - case STIM::OPENING: + case PAGES::OPENING: _DispBuffer = cv::imread(OPENING_FILE); break; - case STIM::CALIB: + case PAGES::CALIB: _DispBuffer = cv::imread(CALIB_FILE); break; - case STIM::CALIB_COMPLETE: + case PAGES::CALIB_COMPLETE: _DispBuffer = cv::imread(CALIB_COMPLETE_FILE); break; - case STIM::CALIB_FAILED: + case PAGES::CALIB_FAILED: _DispBuffer = cv::imread(CALIB_FAILED_FILE); break; - case STIM::START: + case PAGES::START: _StimNo = 0; - StimWithMarker(); + //StimWithMarker(); break; - case STIM::NEXT: - _StimNo = (_StimNo + 1) % _StimImages.size(); - StimWithMarker(); + case PAGES::NEXT: + _StimNo = (_StimNo + 1) % _StimInfoSet.size(); + //StimWithMarker(); break; } } // �h�����Z�b�g -void Stimulus::StimWithMarker() { - cv::Mat img = cv::imread(_StimImages[_StimNo].filename); - _pMarker->Generate(img.size()); - _pMarker->DrawMarker(img); - img.copyTo(_DispBuffer); -} +//void Stimulus::StimWithMarker() { +// cv::Mat img = cv::imread(_StimImages[_StimNo].filename); +// _pMarker->Generate(img.size()); +// _pMarker->DrawMarker(img); +// img.copyTo(_DispBuffer); +//} diff --git a/ECTrainer2/Stimulus.h b/ECTrainer2/Stimulus.h index 009bda4..a5fe216 100644 --- a/ECTrainer2/Stimulus.h +++ b/ECTrainer2/Stimulus.h @@ -7,15 +7,23 @@ class Marker; -struct StimImage { - cv::String filename; - cv::Point2f eyes[2]; +//struct StimImage { +// cv::String filename; +// cv::Point2f eyes[2]; +//}; + +struct StimInfo { + int type; // 1:�摜 2:���� + std::string filename; // �񎦃t�@�C�� + float dulation; // ����(sec) + std::string csvfile; // �^�[�Q�b�g���W�t�@�C���i�����ꍇ��_�A���_�[�o�[�j + int target; // �^�[�Q�b�g�i�����ꍇ��0�j }; class Stimulus : public BaseProcess { public: - enum STIM {OPENING, CALIB, CALIB_COMPLETE, CALIB_FAILED, START, NEXT}; + enum PAGES {OPENING, CALIB, CALIB_COMPLETE, CALIB_FAILED, START, NEXT}; private: const cv::String OPENING_FILE = "../images/ECT_toppage.png"; const cv::String CALIB_FILE = "../images/calib.png"; @@ -24,15 +32,16 @@ const std::string DATA_FILE = "StimData.txt"; Marker* _pMarker; cv::Mat _DispBuffer; - std::vector _StimImages; + std::vector _StimInfoSet; + //std::vector _StimImages; int _StimNo; - void StimWithMarker(); + //void StimWithMarker(); public: Stimulus(ECTrainer* pEct, Marker* pMarker); bool Init(); bool MainLoop(); - void SetStimulus(STIM st); - cv::Point2f GetEyeR() { return _StimImages[_StimNo].eyes[0]; } - cv::Point2f GetEyeL() { return _StimImages[_StimNo].eyes[1]; } + void SetPage(PAGES st); + //cv::Point2f GetEyeR() { return _StimImages[_StimNo].eyes[0]; } + //cv::Point2f GetEyeL() { return _StimImages[_StimNo].eyes[1]; } }; diff --git a/images/LookEyes.png b/images/LookEyes.png new file mode 100644 index 0000000..64720da --- /dev/null +++ b/images/LookEyes.png Binary files differ diff --git a/images/LookNose.png b/images/LookNose.png new file mode 100644 index 0000000..88cd356 --- /dev/null +++ b/images/LookNose.png Binary files differ