Difference between revisions of "Function:ChannelMerge"

From CUVI Wiki
(Created page with "__NOTOC__ Merges R, G and B Channel to form a color image ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus channelMerge(CuviImage* srcRed, ...")
 
Line 6: Line 6:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus channelMerge(CuviImage* srcRed,
CuviStatus channelMerge(const CuviImage& red,
                         CuviImage* srcGreen,
                         const CuviImage& green,
                         CuviImage* srcBlue,
                         const CuviImage& blue,
                         CuviImage* dstImage,
                         CuviImage& dst,
                         CuviStream* stream = NULL);
                         const CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 21: Line 21:
! Description
! Description
|-
|-
| srcRed
| red
| CuviImage*
| const CuviImage&
| Red channel input image
| Red channel input image
|-
|-
| srcGreen
| green
| CuviImage*
| const CuviImage&
| Green channel input image
| Green channel input image
|-
|-
| srcBlue
| blue
| CuviImage*
| const CuviImage&
| Blue channel input image
| Blue channel input image
|-
|-
| dstImage
| dst
| CuviImage*
| const CuviImage&
| 3-channel output Image
| 3-channel output Image
|-
|-
| stream
| stream
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution


Line 74: Line 74:


//Three single channel images
//Three single channel images
CuviImage* gr = new CuviImage(size,r->depth,r->nChannels);
CuviImage gr = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE);
CuviImage* gg = new CuviImage(size,g->depth,g->nChannels);
CuviImage gg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE);
CuviImage* gb = new CuviImage(size,b->depth,b->nChannels);
CuviImage gb = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE);


//A single color image for storing output
//A single color image for storing output
CuviImage* gout = new CuviImage(size,r->depth,3);
CuviImage gout;
 
//Populate the GPU images with pixel data
gr->upload(r->imageData,r->widthStep,st);
gg->upload(g->imageData,g->widthStep,st);
gb->upload(b->imageData,b->widthStep,st);
 
//Merge R, G and B images into a single colored image
//Merge R, G and B images into a single colored image

Revision as of 10:51, 18 April 2013

Merges R, G and B Channel to form a color image

Function

CuviStatus channelMerge(const CuviImage& red,
                        const CuviImage& green,
                        const CuviImage& blue,
                        CuviImage& dst,
                        const CuviStream& stream = CuviStream());

Parameters

Name Type Description
red const CuviImage& Red channel input image
green const CuviImage& Green channel input image
blue const CuviImage& Blue channel input image
dst const CuviImage& 3-channel output Image
stream const CuviStream& GPU stream ID for execution

Image Type Support

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

Sample

Red Channel
Green Channel
Blue Channel
Output Image


Example

//Three single channel images
CuviImage gr = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE);
CuviImage gg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE);
CuviImage gb = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_GRAYSCALE);

//A single color image for storing output
CuviImage gout;
	
//Merge R, G and B images into a single colored image
cuvi::colorOperations::channelMerge(gr,gg,gb,gout);