// stdafx.h : 標準のシステム インクルード ファイルのインクルード ファイル、または
// 参照回数が多く、かつあまり変更されない、プロジェクト専用のインクルード ファイル
// を記述します。
//
#pragma once
// 共通ヘッダーファイル
#include "targetver.h"
#include <stdio.h>
#include <tchar.h>
#include <string.h>
#include <math.h>
#include <omp.h>
#include <cxcore.h>
#include <cv.h>
#include <highgui.h>
#include "HQTime.h"
// 共通定数
#define PATH_LEN 1024 // ファイルパス文字列の最大長
#define COLOR 3 // 色チャネル数
#define DISP_W 640
#define DISP_H 512
#define SHOW_MAX_ROW 100
//#define DEBUG_NUM_FRAMES 40 // 処理フレーム数(デバッグ用)
//#define DEBUG_TRACK_ONLY
//#define CONVERT_IMAGE
//#define SHOW_CV_IMAGE
//#define SHOW_CALIBRATED_MACBETH
//#define SHOW_XYZ_IMAGE
//#define SHOW_RGB_VALUES
//#define SHOW_REGRESSION_COEF
//#define SHOW_FILELOAD
//#define MANUAL_TRACKING_EVALUATION
// 共通マクロ定義
#define SAFE_DELETE(a) if (a) { delete a; a = NULL; }
#define SAFE_DELETEA(a) if (a) { delete [] a; a = NULL; }
#define SAFE_RELEASEIMG(a) if (a) { cvReleaseImage(&a); a = NULL; }
#define SAFE_RELEASEMAT(a) if (a) { cvReleaseMat(&a); a = NULL; }
#define CALL(a) if (!a) return false;
#ifdef _CONSOLE
#define ERROR_RET(msg) { \
fprintf(stderr, "%s\n", msg); \
return false; }
#else
#define ERROR_RET(msg) { \
OutputDebugString(msg); \
OutputDebugString("\n"); \
return false; }
#endif // _CONSOLE
// 共通関数
void GShowMat(const CvMat *mat, const char *name, const char *format = "%6.2f");
bool GFileExists(const char *path);
double GcvmGet(const CvMat *mat, const int row, const int col, const int ch = 0);
int GShowImage(const IplImage *img, const int num = 1,
const char *title = NULL, const int wait = 100);
void GcvResizeD(const IplImage *src, IplImage *dst);
CvMat *GLoadCsv(const char *filename, const int rows, const int cols,
const int startRow = 1, const int startCol = 1);
void GImageDumpD(const IplImage *src, const int num = 10, const char *name = "",
const char *format = "%6.2f");
void GTrimStr(char **buf);
bool GIsSpace(const char ch);
void GcvPMatMul(const CvMat *src1, const CvMat *src2, CvMat *dst);
IplImage *GGenAddGamma(const IplImage *img);
CvScalar GXYZtoLab(CvScalar xyz);