Difference between revisions of "Function:NOT"

From CUVI Wiki
(Created page with "__NOTOC__ Performs a bitwise NOT operation on each pixel ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus NOT(CuviImage* srcImage, ...")
 
 
(7 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
Performs a bitwise NOT operation on each pixel
Inverts the bits of each image pixel.
===Function===
====Function====
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus NOT(CuviImage* srcImage,
CuviStatus NOT(const CuviImage& src,
               CuviImage* dstImage,
               CuviImage& dst,
               CuviStream* stream = NULL);
               const CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}
===Parameters===


====Parameters====
{|
|style="font-size:75%;"|
{|class="wikitable"
{|class="wikitable"
|-
|-
Line 18: Line 20:
! Description
! Description
|-
|-
| srcImage
| src
| CuviImage*
| const CuviImage&
| Input Image
| Input Image
|-
|-
| dstImage
| dst
| CuviImage*
| CuviImage&
| Destination Image
| Destination 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 50: Line 54:
| 16uC3
| 16uC3
| 16uC3
| 16uC3
|}
|}
|}


===Sample===
===Sample===
{|
[[File:NotIn.jpg|none|frame|Input Image]]
|-
<br/>
|[[File:NotIn.jpg|frame|Input Image]]
[[File:NotOut.jpg|none|frame|Negative Image]]
|[[File:NotOut.jpg|frame|Negative Image]]
<br/>
|}


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


//size of host image
CuviSize size = cuviSize(img1->width,img1->height);


//Creating GPU images
//Creating GPU images
CuviImage* gimg = new CuviImage(size,img1->depth,img1->nChannels);
CuviImage gimg = cuvi:io::loadImage(path), gout;
CuviImage* gout = new CuviImage(size,img2->depth,img2->nChannels);


//Populating data
gimg->upload(img1->imageData,img1->widthStep);
//Computing Negative of the image
//Computing Negative of the image
cuvi::arithmeticLogical::NOT(gimg1,gout);
cuvi::arithmeticLogical::NOT(gimg,gout);
 
//The same can be achieved using the ~ operator
gout = ~gimg;


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

Latest revision as of 20:20, 18 October 2022

Inverts the bits of each image pixel.

Function

CuviStatus NOT(const CuviImage& src,
               CuviImage& dst,
               const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
dst CuviImage& Destination Image
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC1 8uC1
8uC3 8uC3
16uC1 16uC1
16uC3 16uC3

Sample

Input Image


Negative Image


Example

//Creating GPU images
CuviImage gimg = cuvi:io::loadImage(path), gout;

	
//Computing Negative of the image
cuvi::arithmeticLogical::NOT(gimg,gout);

//The same can be achieved using the ~ operator
gout = ~gimg;