Difference between revisions of "Function:Sum"

From CUVI Wiki
Line 61: Line 61:
CuviImage* gimg = new CuviImage(size, depth, nChannels);
CuviImage* gimg = new CuviImage(size, depth, nChannels);


Cuvi64f* sum = 0;
Cuvi64f* sum = new Cuvi64f[nChannels];


//Upload input data
//Upload input data
Line 68: Line 68:


//Sum of all pixel values
//Sum of all pixel values
cuvi::arithmeticLogical::sum(gimg, &sum);
cuvi::arithmeticLogical::sum(gimg, sum);


</syntaxhighlight>
</syntaxhighlight>
|}
|}

Revision as of 18:26, 8 May 2012

Computes the sum of all pixel values in the image

Function

CuviStatus sum(CuviImage* image,
               Cuvi64f* sum,
               CuviStream* stream = NULL);

Parameters

Name Type Description
image CuviImage* Input Image
sum Cuvi64f* Sum of all pixel values of the image
stream CuviStream* GPU stream ID for execution

Image Type Support

Input Output
8uC1 Cuvi64f single value
8uC3 Cuvi64f three values

Sample

Sum.PNG


Example

CuviImage* gimg = new CuviImage(size, depth, nChannels);

Cuvi64f* sum = new Cuvi64f[nChannels];

//Upload input data
gimg->upload(hostImg->imageData, hostImg->widthStep);


//Sum of all pixel values	
cuvi::arithmeticLogical::sum(gimg, sum);