Function:ChannelMerge

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

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

Function

CuviStatus channelMerge(CuviImage* srcRed,
                        CuviImage* srcGreen,
                        CuviImage* srcBlue,
                        CuviImage* dstImage,
                        CuviStream* stream = NULL);

Parameters

Name Type Description
srcRed CuviImage* Red channel input image
srcGreen CuviImage* Green channel input image
srcBlue CuviImage* Blue channel input image
dstImage CuviImage* 3-channel output Image
stream 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 = new CuviImage(size,r->depth,r->nChannels);
CuviImage* gg = new CuviImage(size,g->depth,g->nChannels);
CuviImage* gb = new CuviImage(size,b->depth,b->nChannels);

//A single color image for storing output
CuviImage* gout = new CuviImage(size,r->depth,3);

	
//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
cuvi::colorOperations::channelMerge(gr,gg,gb,gout);