Difference between revisions of "Function:Max"

From CUVI Wiki
 
(5 intermediate revisions by 2 users not shown)
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====
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<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());


</syntaxhighlight>
</syntaxhighlight>
|}
|}
===Parameters===


====Parameters====
{|
|style="font-size:75%;"|
{|class="wikitable"
{|class="wikitable"
|-
|-
Line 24: Line 26:
|-
|-
| maxValue
| maxValue
| Cuvi64f*
| CuviScalar&
| Maximum pixel value in the image
| Maximum pixel value(s) in the image
|-
|-
| stream  
| stream  
| const CuviStream&
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution
 
|}
|}
|}


===Image Type Support===
====Image Type Support====
 
{|
|style="font-size:75%;"|
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 41: Line 44:
|-
|-
| 8uC1
| 8uC1
| Cuvi64f single value
| CuviScalar
|-
|-
| 8uC3
| 8uC3
| Cuvi64f three values
| CuviScalar
|-
| 16uC1
| CuviScalar
|-
| 16uC3
| CuviScalar
|-
| 32fC1
| CuviScalar
|-
| 32fC3
| CuviScalar
|}
|}
|}


===Sample===
====Sample====
{|
{|
|-
|-
Line 53: Line 69:
|}
|}


 
====Example====
===Example===
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">


Line 62: Line 77:
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>
|}
|}

Latest revision as of 18:30, 19 October 2022

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);