Difference between revisions of "Function:RGB2Gray"

From CUVI Wiki
Line 5: Line 5:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus RGB2Gray(CuviImage* srcImage,
CuviStatus rgb2gray(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*
| CuviImage&
| Input 3-channel image
| Input 3-channel image
|-
|-
| dstImage
| dst
| CuviImage*
| CuviImage&
| Output single channel image
| Output single channel image
|-
|-
| stream
| stream
| CuviStream*
| CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution


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


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


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


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

Revision as of 08:03, 18 April 2013

Converts an RGB image to gray scale using fixed transform coefficients

Function

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


Parameters

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


Image Type Support

Input Output
8uC3 8uC1
16uC3 16uC1

Sample

Color Image
Output Gray Image


Example

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

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