//#include <C:\OpenCV2.4.3\opencv\build\include\opencv2\opencv.hpp>
//#include <stdio.h>
#include <iostream>
//#include <C:\OpenCV2.4.3\opencv\build\include\opencv2\highgui\highgui.hpp>
//#include <C:\OpenCV2.4.3\opencv\build\include\opencv2\imgproc\imgproc.hpp>
#include <stdlib.h>
#include <math.h>
#include <fstream>

//using namespace cv;
//using namespace std;

#include "opencv2\\opencv.hpp"


#ifdef _DEBUG
    //Debugモードの場合
	#pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_core220d.lib")            // opencv_core
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_imgproc220d.lib")        // opencv_imgproc
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_highgui220d.lib")        // opencv_highgui
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_objdetect220d.lib")    // opencv_objdetect
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_core220d.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_imgproc220d.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_highgui220d.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_objdetect220d.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_contrib220d.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_features2d220d.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_flann220d.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_gpu220d.lib")
    //#pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_haartraining_engined.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_legacy220d.lib")
    //#pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_ts220d.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_video220d.lib")
	#pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_calib3d220d.lib")
	//#pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_nonfree220d.lib")
#else
    //Releaseモードの場合
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_core220.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_imgproc220.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_highgui220.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_objdetect220.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_contrib220.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_features2d220.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_flann220.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_gpu220.lib")
    //#pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_haartraining_engined.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_legacy220.lib")
    //#pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_ts220.lib")
    #pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_video220.lib")
	#pragma comment(lib,"C:\\OpenCV2.2\\lib\\opencv_calib3d220.lib")
	//#pragma comment(lib,"C:\\OpenCV2.4.3\\opencv\\build\\x86\\vc10\\lib\\opencv_calib3d220.lib")
	//#pragma comment(lib,"C:\\OpenCV2.4.3\\opencv\\build\\x86\\vc10\\lib\\opencv_nonfree220.lib")
#endif


void LoadCodeBook(string pathToCodeBook, cv::Mat *codeBook);

#define QUERY

#define NUM_OF_QUERY_IMAGE 100