Difference between revisions of "Function:ChannelMix"

From CUVI Wiki
(Created page with "__NOTOC__ ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus colorTwist(CuviImage* srcImage, CuviImage* dstImage, ...")
 
Line 1: Line 1:
__NOTOC__
__NOTOC__
===Function===
===Function===
{|
{|
Line 37: Line 36:
| GPU stream ID for execution
| GPU stream ID for execution


|}
===Image Type Support===
{| class="wikitable"
|-
! Input
! Output
|-
| 8uC3
| 8uC3
|-
| 16uC3
| 16uC3
|}
===Samples===
{|
|-
|[[File:Twistin.jpg|frame|Input Image]]
|[[File:Twistout.jpg|frame| Output Image]]
|}
===Example===
{|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
CuviImage* gimg = new CuviImage(size,img->depth,img->nChannels);
CuviImage* gout = new CuviImage(size,img->depth,img->nChannels);
gimg->upload(img->imageData,img->widthStep);
//Color-Mix matrix
float* coff = new float[9];
coff[0]= 1.05f;
coff[1]= -0.025f;
coff[2]= -0.025f;
coff[3]= -0.45f;
coff[4]= 1.975f;
coff[5]= -0.525f;
coff[6]= 0.225f;
coff[7]= -1.05f;
coff[8]= 1.825f;
//function call
cuvi::ColorOperations::colorTwist(gimg,gout,coff);
</syntaxhighlight>
|}
|}

Revision as of 15:40, 26 April 2012

Function

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


Parameters

Name Type Description
srcImage CuviImage* Input Image
dstImage CuviImage* Output Image
coeffs[9] Cuvi32f Coefficient matrix for channel mixing
stream CuviStream* GPU stream ID for execution


Image Type Support

Input Output
8uC3 8uC3
16uC3 16uC3

Samples

Input Image
Output Image


Example

CuviImage* gimg = new CuviImage(size,img->depth,img->nChannels);
CuviImage* gout = new CuviImage(size,img->depth,img->nChannels);

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

//Color-Mix matrix
float* coff = new float[9];
	coff[0]= 1.05f;
	coff[1]= -0.025f;
	coff[2]= -0.025f;
	coff[3]= -0.45f;
	coff[4]= 1.975f;
	coff[5]= -0.525f;
	coff[6]= 0.225f;
	coff[7]= -1.05f;
	coff[8]= 1.825f;

//function call
cuvi::ColorOperations::colorTwist(gimg,gout,coff);