Difference between revisions of "Function:Max"

From CUVI Wiki
Line 1: Line 1:
__NOTOC__
__NOTOC__
Computes the maximum of image pixel values
Computes the maximum of image pixel values. Each channel is processed individually.
===Function===
===Function===
{|
{|
Line 6: Line 6:
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus max(const CuviImage& src,
CuviStatus max(const CuviImage& src,
               Cuvi64f* maxValue,
               CuviScalar& maxValue,
               const CuviStream& stream = CuviStream());
               const CuviStream& stream = CuviStream());


Line 24: Line 24:
|-
|-
| maxValue
| maxValue
| Cuvi64f*
| CuviScalar&
| Maximum pixel value in the image
| Maximum pixel value(s) in the image
|-
|-
| stream  
| stream  
Line 41: Line 41:
|-
|-
| 8uC1
| 8uC1
| Cuvi64f single value
| CuviScalar
|-
|-
| 8uC3
| 8uC3
| Cuvi64f three values
| CuviScalar
|-
| 16uC1
| CuviScalar
|-
| 16uC3
| CuviScalar
|-
| 32fC1
| CuviScalar
|-
| 32fC3
| CuviScalar
|}
|}


Line 62: Line 74:
CuviImage gimg = cuvi::io::loadImage(path);
CuviImage gimg = cuvi::io::loadImage(path);


Cuvi64f* max = new Cuvi64f[gimg.channels()];
CuviScalar maxValues;




//Returns maximum pixel value
//Returns maximum pixel value
cuvi::imageStatistics::max(gimg, max);
cuvi::imageStatistics::max(gimg, maxValues);


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

Revision as of 19:38, 12 June 2014

Computes the maximum of image pixel values. Each channel is processed individually.

Function

CuviStatus max(const CuviImage& src,
               CuviScalar& maxValue,
               const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
maxValue CuviScalar& Maximum pixel value(s) in the image
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC1 CuviScalar
8uC3 CuviScalar
16uC1 CuviScalar
16uC3 CuviScalar
32fC1 CuviScalar
32fC3 CuviScalar

Sample

Error creating thumbnail: Unable to save thumbnail to destination


Example

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

CuviScalar maxValues;


//Returns maximum pixel value	
cuvi::imageStatistics::max(gimg, maxValues);