Difference between revisions of "Function:RGB2Gray"

From CUVI Wiki
(Created page with "__NOTOC__ Converts an RGB image to gray scale using fixed transform coefficients ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus rgb2Gray(C...")
 
Line 5: Line 5:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus rgb2Gray(CuviImage* srcImage,
CuviStatus RGB2Gray(CuviImage* srcImage,
                     CuviImage* dstImage,
                     CuviImage* dstImage,
                     CuviStream* stream = NULL);
                     CuviStream* stream = NULL);
Line 71: Line 71:


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


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

Revision as of 09:47, 30 April 2012

Converts an RGB image to gray scale using fixed transform coefficients

Function

CuviStatus RGB2Gray(CuviImage* srcImage,
                    CuviImage* dstImage,
                    CuviStream* stream = NULL);


Parameters

Name Type Description
srcImage CuviImage* Input 3-channel image
dstImage 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 = new CuviImage(size,img->depth,img->nChannels);
CuviImage* gout = new CuviImage(size,img->depth,1);

//Uploading RGB image to GPU
gimg->upload(img->imageData,img->widthStep);

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