本文整理汇总了C++中Pyramid::Mul方法的典型用法代码示例。如果您正苦于以下问题:C++ Pyramid::Mul方法的具体用法?C++ Pyramid::Mul怎么用?C++ Pyramid::Mul使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pyramid
的用法示例。
在下文中一共展示了Pyramid::Mul方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: flt_weights
/**
* @brief ExposureFusion
* @param imgIn
* @param wC
* @param wE
* @param wS
* @param imgOut
* @return
*/
Image *ExposureFusion(ImageVec imgIn, float wC = 1.0f, float wE = 1.0f,
float wS = 1.0f, Image *imgOut = NULL)
{
int n = imgIn.size();
if(n < 2) {
return imgOut;
}
//Computing weights values
int channels = imgIn[0]->channels;
int width = imgIn[0]->width;
int height = imgIn[0]->height;
Image *lum = new Image(1, width, height, 1);
Image *weights = new Image(1, width, height, 1);
Image *acc = new Image(1, width, height, 1);
acc->SetZero();
FilterLuminance flt_lum;
FilterExposureFusionWeights flt_weights(wC, wE, wS);
for(int j = 0; j < n; j++) {
#ifdef PIC_DEBUG
printf("Processing image %d\n", j);
#endif
lum = flt_lum.ProcessP(Single(imgIn[j]), lum);
weights = flt_weights.ProcessP(Double(lum, imgIn[j]), weights);
*acc += *weights;
}
for(int i=0; i<acc->size(); i++) {
acc->data[i] = acc->data[i] > 0.0f ? acc->data[i] : 1.0f;
}
//Accumulation Pyramid
#ifdef PIC_DEBUG
printf("Blending...");
#endif
Pyramid *pW = new Pyramid(width, height, 1, false);
Pyramid *pI = new Pyramid(width, height, channels, true);
Pyramid *pOut = new Pyramid(width, height, channels, true);
pOut->SetValue(0.0f);
for(int j = 0; j < n; j++) {
lum = flt_lum.ProcessP(Single(imgIn[j]), lum);
weights = flt_weights.ProcessP(Double(lum, imgIn[j]), weights);
//normalization
*weights /= *acc;
pW->Update(weights);
pI->Update(imgIn[j]);
pI->Mul(pW);
pOut->Add(pI);
}
#ifdef PIC_DEBUG
printf(" ok\n");
#endif
//final result
imgOut = pOut->Reconstruct(imgOut);
#pragma omp parallel for
for(int i = 0; i < imgOut->size(); i++) {
imgOut->data[i] = MAX(imgOut->data[i], 0.0f);
}
//free the memory
delete pW;
delete pOut;
delete pI;
delete acc;
delete weights;
delete lum;
return imgOut;
}