Function:Sum

From CUVI Wiki
Revision as of 14:28, 8 May 2012 by Jawad (talk | contribs) (Created page with "__NOTOC__ Computes the sum of all pixel values in the image ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus sum(CuviImage* image, ...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

Error creating thumbnail: Unable to save thumbnail to destination
First Input Image
Error creating thumbnail: Unable to save thumbnail to destination
Second Input Image
Error creating thumbnail: Unable to save thumbnail to destination
Resultant Image


Example

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

Cuvi64f* sum = 0;

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


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