Difference between revisions of "Function:ChannelSplit"

From CUVI Wiki
Line 6: Line 6:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus channelSplit(CuviImage* srcImage,
CuviStatus channelSplit(const CuviImage& src,
                         CuviImage* dstRed,
                         CuviImage& red,
                         CuviImage* dstGreen,
                         CuviImage& green,
                         CuviImage* dstBlue,
                         CuviImage& blue,
                         CuviStream* stream = NULL);
                         const CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 22: Line 22:
|-
|-
| src
| src
| CuviImage*
| const CuviImage&
| 3-channel input Image
| 3-channel input Image
|-
|-
| dstRed
| red
| CuviImage*
| CuviImage&
| Output red channel image
| Output red channel image
|-
|-
| dstGreen
| green
| CuviImage*
| CuviImage&
| Output green channel image
| Output green channel image
|-
|-
| dstBlue
| blue
| CuviImage*
| CuviImage&
| Output blue channel image
| Output blue channel image
|-
|-
| stream
| stream
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution


Line 73: Line 73:


//A single color image
//A single color image
CuviImage *gimg = new CuviImage(_size,img->depth,img->nChannels);
CuviImage gimg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_COLOR);


//Three single channel images for storing output
//Three single channel images for storing output
CuviImage *gr = new CuviImage(_size,img->depth,1);
CuviImage gr, gg, gb;
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
//Split into R, G and B channels

Revision as of 18:59, 18 April 2013

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

Function

CuviStatus channelSplit(const CuviImage& src,
                        CuviImage& red,
                        CuviImage& green,
                        CuviImage& blue,
                        const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& 3-channel input Image
red CuviImage& Output red channel image
green CuviImage& Output green channel image
blue CuviImage& Output blue channel image
stream const 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 = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_COLOR);

//Three single channel images for storing output
CuviImage gr, gg, gb;

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