Difference between revisions of "Function:Max"

From CUVI Wiki
 
(7 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(CuviImage* image,
CuviStatus max(const CuviImage& src,
               Cuvi64f* maxValue,
               CuviScalar& maxValue,
               CuviStream* stream = NULL);
               const CuviStream& stream = CuviStream());


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


====Parameters====
{|
|style="font-size:75%;"|
{|class="wikitable"
{|class="wikitable"
|-
|-
Line 19: Line 21:
! Description
! Description
|-
|-
| image
| src
| CuviImage*
| const CuviImage&
| Input Image
| Input Image
|-
|-
| maxValue
| maxValue
| Cuvi64f*
| CuviScalar&
| Maximum pixel value in the image
| Maximum pixel value(s) in the image
|-
|-
| stream  
| stream  
| 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">




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


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




//Returns maximum pixel value
//Returns maximum pixel value
cuvi::arithmeticLogical::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);