Difference between revisions of "Function:Add"
From CUVI Wiki
(8 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
Adds two images | Adds two images or adds a constant to each pixel of the image. | ||
===Function=== | ====Function==== | ||
{| | {| | ||
|style="font-size: | |style="font-size:100%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
CuviStatus add(CuviImage | CuviStatus add(const CuviImage& src1, | ||
CuviImage | const CuviImage& src2, | ||
CuviImage | CuviImage& dst, | ||
CuviStream | const CuviStream& stream = CuviStream()); | ||
CuviStatus add(const CuviImage& src, | |||
const CuviScalar& values, | |||
CuviImage& dst, | |||
const CuviStream& stream = CuviStream()); | |||
CuviStatus add(const CuviImage& src, | |||
const Cuvi64f value, | |||
CuviImage& dst, | |||
const CuviStream& stream = CuviStream()); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
__NOTOC__ | |||
====Parameters==== | |||
{| | |||
|style="font-size:75%;"| | |||
{|class="wikitable" | {|class="wikitable" | ||
|- | |- | ||
Line 19: | Line 33: | ||
! Description | ! Description | ||
|- | |- | ||
| | | src1 | ||
| CuviImage | | CuviImage& | ||
| First Input Image | | First Input Image | ||
|- | |- | ||
| | | src2 | ||
| CuviImage | | CuviImage& | ||
| Second Input Image | | Second Input Image | ||
|- | |- | ||
| | | dst | ||
| CuviImage | | CuviImage& | ||
| Resultant Image | | Resultant Image | ||
|- | |- | ||
| stream | | stream | ||
| CuviStream | | 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 48: | Line 63: | ||
| 8u | | 8u | ||
| 8u | | 8u | ||
|- | |- | ||
| 16u | | 16u | ||
Line 60: | Line 71: | ||
| 32f | | 32f | ||
| 32f | | 32f | ||
|- | |- | ||
| | | 8u | ||
| | | 8u | ||
| 16u | |||
|- | |||
| 8u | |||
| 8u | |||
| 32f | |||
|- | |- | ||
| | | 16u | ||
| 16u | |||
| 32f | |||
|} | |||
|} | |} | ||
====Sample==== | |||
[[File:Addin1.jpg|none|frame|First Input Image]] | |||
<br/> | |||
[[File:Addin2.jpg|none|frame|Second Input Image]] | |||
<br/> | |||
[[File:AddOut.jpg|none|frame|Resultant Image]] | |||
<br/> | |||
===Example=== | ====Example==== | ||
{| | {| | ||
|style="font-size: | |style="font-size:100%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
CuviImage | CuviImage gimg1 = cuvi::io::loadImage(path); | ||
CuviImage | CuviImage gimg2 = cuvi::io::loadImage(path); | ||
CuviImage | CuviImage gout; | ||
//Add | //Add | ||
cuvi::arithmeticLogical::add(gimg1,gimg2,gout); | cuvi::arithmeticLogical::add(gimg1,gimg2,gout); | ||
//The same can be achieved by using arithmetic operators | |||
gout = gimg1 + gimg2; | |||
//Add a constant value to each pixel of the image | |||
gimg1 += 10; | |||
//Add a different value to each channel | |||
gimg2 += CuviScalar(5,10,3); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} |
Latest revision as of 15:09, 7 November 2022
Adds two images or adds a constant to each pixel of the image.
Function
|
Parameters
|
Image Type Support
|
Sample
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
Example
|