Difference between revisions of "Function:ChannelMix"

From CUVI Wiki
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
===Function===
====Function====
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus colorTwist(CuviImage* srcImage,
CuviStatus cuvi::colorOperations::channelMix(const CuviImage& src,
                      CuviImage* dstImage,
                                            CuviImage& dst,
                      Cuvi32f coeffs[9],
                                            Cuvi32f coeffs[12],
                      CuviStream* stream = NULL);
                                            CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}


 
====Parameters====
===Parameters===
{|
 
|style="font-size:75%;"|
{|class="wikitable"
{|class="wikitable"
|-
|-
Line 20: Line 20:
! Description
! Description
|-
|-
| srcImage
| src
| CuviImage*
| const CuviImage&
| Input Image
| Input Image
|-
|-
| dstImage
| dst
| CuviImage*
| CuviImage&
| Output Image
| Output Image
|-
|-
| coeffs[9]
| coeffs[12]
| Cuvi32f
| Cuvi32f
| Coefficient matrix for channel mixing
| Augmented coefficient matrix for channel mixing
|-
|-
| stream
| stream
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution
|}
|}
 
|}
 


===Image Type Support===
===Image Type Support===
 
{|
|style="font-size:75%;"|
{| class="wikitable"
{| class="wikitable"
|-
|-
Line 53: Line 52:
| 16uC3
| 16uC3
|}
|}
===Sample===
{|
|-
|[[File:Twistin.jpg|frame|Input Image]]
|[[File:Twistout.jpg|frame| Output Image]]
|}
|}


====Sample====
[[File:Twistin.jpg|none|frame|Input Image]]
<br/>
[[File:Twistout.jpg|none|frame| Output Image]]
<br/>


 
====Example====
===Example===
{|
{|
|style="font-size:150%;"|
|style="font-size:100%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">


CuviImage* gimg = new CuviImage(size,img->depth,img->nChannels);
CuviImage gimg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_COLOR);
CuviImage* gout = new CuviImage(size,img->depth,img->nChannels);


gimg->upload(img->imageData,img->widthStep);
//Color-Mix matrix
float coeffs[12] = {
                    1.05, -0.025f, -0.025f, 0.0f,
                    -0.45f, 1.975f, -0.525f, 0.0f,
                    0.225f, -1.05f, 1.825f, 0.0f
                  };


//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
//function call
cuvi::ColorOperations::colorTwist(gimg,gout,coff);
cuvi::colorOperations::colorTwist(gimg,gout,coeffs);


</syntaxhighlight>
</syntaxhighlight>
|}
|}

Latest revision as of 20:42, 18 October 2022

Function

CuviStatus cuvi::colorOperations::channelMix(const CuviImage& src,
                                             CuviImage& dst,
                                             Cuvi32f coeffs[12],
                                             CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
dst CuviImage& Output Image
coeffs[12] Cuvi32f Augmented coefficient matrix for channel mixing
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC3 8uC3
16uC3 16uC3

Sample

Error creating thumbnail: Unable to save thumbnail to destination
Input Image


Error creating thumbnail: Unable to save thumbnail to destination
Output Image


Example

CuviImage gimg = cuvi::io::loadImage(path,CUVI_LOAD_IMAGE_COLOR);

//Color-Mix matrix
float coeffs[12] = { 
                     1.05, -0.025f, -0.025f, 0.0f,
                     -0.45f, 1.975f, -0.525f, 0.0f, 
                     0.225f, -1.05f, 1.825f, 0.0f
                   };


//function call
cuvi::colorOperations::colorTwist(gimg,gout,coeffs);