Function:ChannelSplit

From CUVI Wiki
Revision as of 16:50, 26 April 2012 by Jawad (talk | contribs)

Splits a three channel image into R, G and B channels

Function

CuviStatus channelSplit(CuviImage* srcImage,
                        CuviImage* dstRed,
                        CuviImage* dstGreen,
                        CuviImage* dstBlue,
                        CuviStream* stream = NULL);

Parameters

Name Type Description
src CuviImage* 3-channel input Image
dstRed CuviImage* Output red channel image
dstGreen CuviImage* Output green channel image
dstBlue CuviImage* Output blue channel image
stream CuviStream* GPU stream ID for execution

Image Type Support

Input Output
8uC3 8uC1 x 3
16uC3 16uC1 x 3

Sample

Error creating thumbnail: Unable to save thumbnail to destination
Input Image
Error creating thumbnail: Unable to save thumbnail to destination
Red Channel
Error creating thumbnail: Unable to save thumbnail to destination
Green Channel
Error creating thumbnail: Unable to save thumbnail to destination
Blue Channel


Example

//A single color image
CuviImage *gimg = new CuviImage(_size,img->depth,img->nChannels);

//Three single channel images for storing output
CuviImage *gr = new CuviImage(_size,img->depth,1);
CuviImage *gg = new CuviImage(_size,img->depth,1);
CuviImage *gb = new CuviImage(_size,img->depth,1);

//Populate the GPU image with pixel data
gimg->upload(img->imageData,img->widthStep);

//Split into R, G and B channels
CuviStatus st = cuvi::colorOperations::channelSplit(gimg,gr,gg,gb);