本文整理汇总了C++中TrainingSet::FileColorInfo方法的典型用法代码示例。如果您正苦于以下问题:C++ TrainingSet::FileColorInfo方法的具体用法?C++ TrainingSet::FileColorInfo怎么用?C++ TrainingSet::FileColorInfo使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TrainingSet
的用法示例。
在下文中一共展示了TrainingSet::FileColorInfo方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: GeneraTrainSet
void GeneraTrainSet()
{
int num = LoadTrainPic();
int traiNo = TRAINFILENAME.size();
TrainingSet *trainSet = new TrainingSet();
int keycount = 0, currentImgNo = 0;
//Values(num);
Key = cvCreateMat(num, 61, CV_32F);
HighMean = new float[num];
Valuse = new Point2d[num];
//Values = cvCreateMat(num, 25, CV_32FC3);
for (int i = 0; i < traiNo; i++)
{
//Mat srcImg = imread(TRAINFILENAME[i], 1);
//Mat srcImg = imread("images\\input\\123.jpg",1);//CV_32S
//Mat srcrgb = imread("images\\input\\123.jpg", CV_LOAD_IMAGE_GRAYSCALE);//CV_8U
Mat srcImg = InputImg[i];
Mat srColorImg= InputColorImg[i];
int x=srColorImg.type();
srcImg.convertTo(srcImg, CV_32FC1);
srColorImg.convertTo(srColorImg,CV_32FC3);
x=srColorImg.type();
for (int row = 0; row < srcImg.rows; row++)
{
for (int col = 0; col < srcImg.cols; col++)
{
srcImg.at<float>(row, col) = srcImg.at<float>(row, col) / 255.0;
srColorImg.at<Vec3f>(row, col)[0] = srColorImg.at<Vec3f>(row, col)[0] / 255.0;
srColorImg.at<Vec3f>(row, col)[1] = srColorImg.at<Vec3f>(row, col)[1] / 255.0;
srColorImg.at<Vec3f>(row, col)[2] = srColorImg.at<Vec3f>(row, col)[2] / 255.0;
}
}
Mat lowResImg, highResImg, cubicImg;
GeneraLHImg(lowResImg, highResImg, srcImg, cubicImg);
Mat colorlowResImg, colorhighResImg, colorcubicImg;
GeneraLHImg(colorlowResImg, colorhighResImg, srColorImg, colorcubicImg);
char temps[50];
sprintf(temps, "%d_lowresImg.png", i);
string s(temps);
imwrite(TEST + s, lowResImg*255.0);
sprintf(temps, "%d_highImg.png", i);
string c(temps);
imwrite(TEST + c, highResImg*255.0);
sprintf(temps, "%d_colorlowresImg.png", i);
string sc(temps);
imwrite(TEST + sc, colorlowResImg*255.0);
sprintf(temps, "%d_colorhighresImg.png", i);
string cs(temps);
imwrite(TEST + cs, colorhighResImg*255.0);
PatchGen *lowResPatches = new PatchGen(lowResImg, 7);
lowResPatches->Initalize(CV_32F);
PatchGen *higResPatches = new PatchGen(highResImg, 5);
higResPatches->Initalize(CV_32F);
//colorlowResImg.convertTo(colorlowResImg,CV_32FC3);
PatchGen *colorlowResPatches = new PatchGen(colorlowResImg, 7);
colorlowResPatches->Initalize(CV_32FC3);
PatchGen *colorhigResPatches = new PatchGen(colorhighResImg, 5);
colorhigResPatches->Initalize(CV_32FC3);
InputHigh[i] = highResImg.clone();
/*if (i == 4){
int error = 1;
}*/
//trainSet->FileInfo(lowResPatches, higResPatches, ALPHA, lowResPatches->m_patch_rowNo, lowResPatches->m_patch_colNo, Key, Valuse, HighMean, keycount);
trainSet->FileColorInfo(colorlowResPatches,colorhigResPatches,lowResPatches, higResPatches, ALPHA,COLORCONS, lowResPatches->m_patch_rowNo, lowResPatches->m_patch_colNo, Key, Valuse, HighMean, keycount);
delete lowResPatches;
delete higResPatches;
delete colorlowResPatches;
delete colorhigResPatches;
}
delete trainSet;
}