Weighted Sum Filter
Filter
RIF_IMAGE_FILTER_WEIGHTED_SUM
Description
Calculates the weighted sum of the images (outputImg = W0 * inputImg0 + W1 * inputImg1 + .. WN * inputImgN). The input image passed in rifCommandQueueAttachImageFilter()
is not used.
Parameters
Parameter |
Type |
Input/Output |
Description |
---|---|---|---|
inputs |
array of images |
input |
Array of images which will be added. |
weights |
array of floats |
input |
Array of weighting coefficients. |
inputsNum |
uint |
input |
The number of images (images arrays size). |
Usage Example
std::vector<rif_image> inputs;
std::vector<float> weights;
inputs.push_back(img0);
inputs.push_back(img1);
//.......................
inputs.push_back(imgN);
weights.push_back(0.1);
weights.push_back(-0.5);
//.......................
weights.push_back(2);
rifContextCreateImageFilter(context, RIF_IMAGE_FILTER_WEIGHTED_SUM, &filter);
rifImageFilterSetParameterImageArray(filter, "inputs", &inputs[0], inputs.size());
rifImageFilterSetParameterFloatArray(filter, "weights", &weights[0], weights.size());
rifImageFilterSetParameter1u(filter, "inputsNum", inputs.size());
rifCommandQueueAttachImageFilter(queue, filter, inputs[0], outputImage);
rifContextExecuteCommandQueue(context, queue, nullptr, nullptr, nullptr);