Difference between revisions of "Function:RGBA2Gray"

From CUVI Wiki
(Created page with "__NOTOC__ Converts an RGBA image to gray scale using fixed transform ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus RGBA2Gray(CuviImage* s...")
 
 
Line 5: Line 5:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus RGBA2Gray(CuviImage* srcImage,
CuviStatus rgba2gray(const CuviImage& src,
                     CuviImage* dstImage,
                     CuviImage& dst,
                     CuviStream* stream = NULL);
                     const CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 20: Line 20:
! Description
! Description
|-
|-
| srcImage
| src
| CuviImage*
| const CuviImage&
| Input 4-channel image
| Input 4-channel image
|-
|-
| dstImage
| dst
| CuviImage*
| CuviImage&
| Output single channel image
| Output single channel image
|-
|-
| stream
| stream
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution


Line 56: Line 56:
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">


CuviImage* gimg = new CuviImage(size,img->depth,img->nChannels);
CuviImage gimg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_DEFAULT), gout;
CuviImage* gout = new CuviImage(size,img->depth,1);
 
//Uploading RGBA image to GPU
gimg->upload(img->imageData,img->widthStep);




//function call
//function call
cuvi::colorOperations::RGBA2Gray(gimg,gout);
cuvi::colorOperations::rgba2gray(gimg,gout);


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

Latest revision as of 08:52, 19 April 2013

Converts an RGBA image to gray scale using fixed transform

Function

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


Parameters

Name Type Description
src const CuviImage& Input 4-channel image
dst CuviImage& Output single channel image
stream const CuviStream& GPU stream ID for execution


Image Type Support

Input Output
8uC4 8uC1
16uC4 16uC1


Example

CuviImage gimg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_DEFAULT), gout;


//function call
cuvi::colorOperations::rgba2gray(gimg,gout);