本文整理汇总了C++中Pixmap::computeVariance方法的典型用法代码示例。如果您正苦于以下问题:C++ Pixmap::computeVariance方法的具体用法?C++ Pixmap::computeVariance怎么用?C++ Pixmap::computeVariance使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pixmap
的用法示例。
在下文中一共展示了Pixmap::computeVariance方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: searchJob
void PixmapCompressor::searchJob(const std::vector<SubPixmap>& rangeRegions, const std::vector<SubPixmap>& domainRegions, unsigned short start, unsigned short end, std::map<unsigned short, Result>& results, unsigned short& status)
{
status = 0;
//For each domain region this thread must handle
for (int i = start; i < end; ++i)
{
//Store every transformations for this domain region to avoid computing them several times
Pixmap* transformationsResults[16];
transformationsResults[0] = domainRegions[i].pixmap->downscale(m_rangeRegionSize);
transformationsResults[1] = transformationsResults[0]->applyTransformation(ROTATION_90); //ROTATION_90 = 1
transformationsResults[2] = transformationsResults[0]->applyTransformation(ROTATION_180); //ROTATION_180 = 2
transformationsResults[3] = transformationsResults[0]->applyTransformation(ROTATION_270); //ROTATION_270 = 3
transformationsResults[4] = transformationsResults[0]->applyTransformation(FLIP); //FLIP = 4
transformationsResults[5] = transformationsResults[4]->applyTransformation(ROTATION_90); //ROTATION_90 | FLIP = 5
transformationsResults[6] = transformationsResults[4]->applyTransformation(ROTATION_180); //ROTATION_90 | FLIP = 6
transformationsResults[7] = transformationsResults[4]->applyTransformation(ROTATION_270); //ROTATION_90 | FLIP = 7
transformationsResults[8] = transformationsResults[0]->applyTransformation(INVERT); //INVERT = 8
transformationsResults[9] = transformationsResults[8]->applyTransformation(ROTATION_90); //ROTATION_90 | INVERT = 9
transformationsResults[10] = transformationsResults[8]->applyTransformation(ROTATION_180); //ROTATION_180 | INVERT = 10
transformationsResults[11] = transformationsResults[8]->applyTransformation(ROTATION_270); //ROTATION_270 | INVERT = 11
transformationsResults[12] = transformationsResults[8]->applyTransformation(FLIP); //FLIP | INVERT = 12
transformationsResults[13] = transformationsResults[12]->applyTransformation(ROTATION_90); //ROTATION_90 | FLIP | INVERT = 13
transformationsResults[14] = transformationsResults[12]->applyTransformation(ROTATION_180); //ROTATION_180 | FLIP | INVERT = 14
transformationsResults[15] = transformationsResults[12]->applyTransformation(ROTATION_270); //ROTATION_270 | FLIP | INVERT = 15
//For each range region
for (unsigned int r = 0; r < rangeRegions.size(); ++r)
{
auto& currentResult = results[r];
Pixmap* currentRegion = rangeRegions[r].pixmap;
//For each transformation
//If we already got a perfect match, skip
for (int j = 0; currentResult.variance > 0 && j < 16; ++j)
{
unsigned short variance = currentRegion->computeVariance(*transformationsResults[j]);
//We're looking for the minimum variance (best match)
if (variance < currentResult.variance)
{
currentResult.variance = variance;
currentResult.transformationId = j;
currentResult.domainId = i;
}
}
}
//Clean stored transformations
for (int j = 0; j < 16; ++j)
delete transformationsResults[j];
++status;
}
status = STATUS_DONE;
}