Function:RGB2Gray

From CUVI Wiki
Revision as of 17:44, 30 April 2012 by Jawad (talk | contribs) (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...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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

Error creating thumbnail: Unable to save thumbnail to destination
Color Image
Error creating thumbnail: Unable to save thumbnail to destination
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::color2Gray(gimg,gout);