diff --git a/ECTrainer2/BaseProcess.h b/ECTrainer2/BaseProcess.h index 1bd41d7..62cf9f3 100644 --- a/ECTrainer2/BaseProcess.h +++ b/ECTrainer2/BaseProcess.h @@ -11,7 +11,7 @@ HANDLE _threadHandle; // スレッドハンドル DWORD _threadID; // スレッドID bool _mainThread; // メイン(GUI)スレッドかどうか - int _fpsMeasureTime; // FPSを算出する時間(ms) + DWORD _fpsMeasureTime; // FPSを算出する時間(ms) protected: void* _pUserdata; diff --git a/ECTrainer2/Worker.cpp b/ECTrainer2/Worker.cpp index c08328f..096007e 100644 --- a/ECTrainer2/Worker.cpp +++ b/ECTrainer2/Worker.cpp @@ -307,7 +307,9 @@ // イベントログ出力 void Worker::EventLog(const TCHAR* msg) { + CreateDirectory(_T(LOG_DIR), NULL); FILE* fp = NULL; // イベントログファイルポインタ + if (_tfopen_s(&fp, EVENT_LOG_FILE, _T("a")) != 0) { Ect()->MsgBox(_T("Can't open event log file."), MB_ICONERROR); return; diff --git a/ECTrainer2/Worker.h b/ECTrainer2/Worker.h index 7187040..828ed9c 100644 --- a/ECTrainer2/Worker.h +++ b/ECTrainer2/Worker.h @@ -24,8 +24,9 @@ const TCHAR* SOUND_GREAT = _T("../voices/Great_S.wav"); const TCHAR* SOUND_EXCELLENT = _T("../voices/Excellent_S.wav"); const TCHAR* SOUND_GOOUT = _T("../voices/KbdKeyTap.wav"); - const char* DATA_LOG_FILE = "../log/%s_%s_%d.csv"; - const TCHAR* EVENT_LOG_FILE = _T("../log/events.txt"); + #define LOG_DIR "../log/" + const char* DATA_LOG_FILE = LOG_DIR "%s_%s_%d.csv"; + const TCHAR* EVENT_LOG_FILE = _T(LOG_DIR "events.txt"); const int FEEDBACK_TIME = 3000; // フィードバックの時間(1レベル)msec const int SHIFT_LOG_STARTTIME = 2000; // 注視点ずれ記録開始時間 const float TRAINING_LEVEL_EFFECT = 0.1F; // トレーニングレベルによる目標領域縮小量 diff --git a/ECTrainer2/nkcOpenCV.cpp b/ECTrainer2/nkcOpenCV.cpp index 09ef1cd..1fda25b 100644 --- a/ECTrainer2/nkcOpenCV.cpp +++ b/ECTrainer2/nkcOpenCV.cpp @@ -1,16 +1,16 @@ -#include "nkcOpenCV.h" +#include "nkcOpenCV.h" #include namespace nkc { namespace ocv { -// �҂��Ȃ�waitKey() +// 待たないwaitKey() int noWaitKey() { MSG msg; while (::PeekMessage(&msg, NULL, 0, 0, PM_NOREMOVE)) { if (::GetMessage(&msg, NULL, 0, 0) == 0) { // WM_QUIT - ::PostQuitMessage(msg.wParam); + ::PostQuitMessage((int)msg.wParam); return 0; } @@ -22,12 +22,12 @@ return -1; } -// �����摜���c���ɘA���\�� +// 複数画像を縦横に連結表示 void imShowMulti( - cv::String winname, std::vector& imgs, // �S�Ă̕\���摜�i8bit 3ch or 8bit 1ch�̂�) - unsigned int cols, // ���̘A���� - unsigned int rows, // �c�̘A���� - cv::Size imgsize, // �\������摜�T�C�Y + cv::String winname, std::vector& imgs, // 全ての表示画像(8bit 3ch or 8bit 1chのみ) + unsigned int cols, // 横の連結数 + unsigned int rows, // 縦の連結数 + cv::Size imgsize, // 表示する画像サイズ unsigned int border) { if (imgs.size() < 1 || cols < 1 || rows < 1) return; @@ -55,25 +55,25 @@ imshow(winname, board); } -// �c�����ۂ������T�C�Y +// 縦横比を保ったリサイズ cv::Mat KeepAspectResize(cv::Mat& img, int width, int height) { cv::Size outputSize; if (width > 0) { if (height > 0) { - // �c���w��i���T�C�Y�Ɏ��܂�悤�ɂ���j + // 縦横指定(両サイズに収まるようにする) outputSize = cv::Size(height * img.cols / img.rows, width * img.rows / img.cols); if (outputSize.width > width) outputSize.width = width; else outputSize.height = height; } else { - // �����w�� + // 横幅指定 outputSize = cv::Size(width, width * img.rows / img.cols); } } else { if (height > 0) { - // �c���w�� + // 縦幅指定 outputSize = cv::Size(height * img.cols / img.rows, height); } else { - // �c���ǂ�����w�薳���ꍇ�͓��͂̃R�s�[��Ԃ� + // 縦横どちらも指定無い場合は入力のコピーを返す return img.clone(); } } @@ -82,7 +82,7 @@ return resized; } -// �E�C���h�E�n���h�����擾 +// ウインドウハンドルを取得 HANDLE getWindowHandle(cv::String winname) { return ::FindWindowA(NULL, winname.c_str()); }