OpenCV Gray2RGB[原创]

#include 
#include 
#include 
#include 

using namespace cv;

struct Mapping
{
    int red;
    int green;
    int blue;
};

void gray2rgb(CvMat *src,CvMat *refer,CvMat **dest)
{
    CvMat *referG;
    Mapping mapping[256];

    int srcRows=src->rows;
    int srcCols=src->cols;
    *dest=cvCreateMat(srcRows,srcCols,CV_8UC3);

    int refRows=refer->rows;
    int refCols=refer->cols;
    referG=cvCreateMat(refRows,refCols,CV_8U);
    cvCvtColor(refer,referG,CV_RGB2GRAY);

    for (int i=0;i<256;i++)
    {
        int d=255,minD=255,minRow,minCol;
        for (int j=0;j

你可能感兴趣的:(OpenCV Gray2RGB[原创])