Function:Color2Gray

From CUVI Wiki
Revision as of 09:20, 30 April 2012 by Jawad (talk | contribs) (Created page with "__NOTOC__ Converts an RGB image to gray scale using custom transform coefficients ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus color2Gra...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Converts an RGB image to gray scale using custom transform coefficients

Function

CuviStatus color2Gray(CuviImage* srcImage,
                      CuviImage* dstImage,
                      Cuvi32f coeffs[3],
                      CuviStream* stream = NULL);


Parameters

Name Type Description
srcImage CuviImage* Input 3-channel image
dstImage CuviImage* Output single channel image
coeffs[3] Cuvi32f Transform coefficients
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);

gimg->upload(img->imageData,img->widthStep);

//Transform coefficients
float* coff = new float[3];
	coff[0]= 0.3f;
	coff[1]= 0.59f;
	coff[2]= 0.11f;


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