//#include "stdafx.h"
#include <opencv2/opencv.hpp>
#include <iostream>
#include <stdio.h>
#include <string>
#include "cv.h"
#include <math.h>
using namespace cv;
using namespace std;
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
#define N 12 //颜色模板的个数
// 颜色模板
// 黑、白、红、绿、蓝、黄/ 棕 、灰
#define BLACK 0
#define WHITE 1
#define RED1 2
#define RED2 3
#define GREEN1 4
#define GREEN2 5
#define BLUE1 6
#define BLUE2 7
#define YELLOW1 8
#define YELLOW2 9
#define BROWN 10
#define GRAY 11
int colorVelue[N][3] = { { 0, 0, 0 }, //黑
{ 255, 255, 255 }, //白
{ 139, 0, 0 }, //暗红
{ 240, 0, 0 }, //红大
{ 80, 240, 80 }, //绿小
{ 0, 240, 0 }, //绿大
{ 80, 80, 240 }, //蓝小
{ 0, 0, 240 }, //蓝大
{ 240, 80, 80 }, //黄小
{ 240, 240, 0 }, //黄大
{ 115, 74, 18 }, //棕
{ 162, 162, 162 } }; //灰
int Color_difference_RGB(IplImage * image)
{
int type = 0;
IplImage* R = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
IplImage* G = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
IplImage* B = cvCreateImage(cvGetSize(image), IPL_DEPTH_8U, 1);
// 高斯模糊