Difference between revisions of "Function:Mean"

From CUVI Wiki
Line 5: Line 5:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus mean(CuviImage* image,
CuviStatus mean(const CuviImage& src,
                 Cuvi64f* mean,
                 Cuvi64f* mean,
                 CuviStream* stream = NULL);
                 const CuviStream& stream = CuviStream());


</syntaxhighlight>
</syntaxhighlight>
Line 19: Line 19:
! Description
! Description
|-
|-
| image
| src
| CuviImage*
| const CuviImage&
| Input Image
| Input Image
|-
|-
Line 28: Line 28:
|-
|-
| stream  
| stream  
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution


Line 60: Line 60:




CuviImage* gimg = new CuviImage(size, depth, nChannels);
CuviImage gimg = cuvi::io::loadImage(path);


Cuvi64f* mean = new Cuvi64f[nChannels];
Cuvi64f* mean = new Cuvi64f[gimg.channels()];
 
//Upload input data
gimg->upload(hostImg->imageData, hostImg->widthStep);




//Returns mean of all pixel values in the image
//Returns mean of all pixel values in the image
cuvi::arithmeticLogical::mean(gimg, mean);
cuvi::imageStatistics::mean(gimg, mean);


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

Revision as of 13:57, 19 April 2013

Computes the mean of image pixel values

Function

CuviStatus mean(const CuviImage& src,
                Cuvi64f* mean,
                const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
mean Cuvi64f* Mean of all pixel values in the image
stream const 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


Example

CuviImage gimg = cuvi::io::loadImage(path);

Cuvi64f* mean = new Cuvi64f[gimg.channels()];


//Returns mean of all pixel values in the image	
cuvi::imageStatistics::mean(gimg, mean);