|
|
| Line 1: |
Line 1: |
| __NOTOC__
| |
| Converts an RGB image to gray scale using custom transform coefficients
| |
| ===Function===
| |
| {|
| |
| |style="font-size:150%;"|
| |
| <syntaxhighlight lang="cpp">
| |
| CuviStatus color2Gray(CuviImage* srcImage,
| |
| CuviImage* dstImage,
| |
| Cuvi32f coeffs[3],
| |
| CuviStream* stream = NULL);
| |
| </syntaxhighlight>
| |
| |}
| |
|
| |
|
|
| |
| ===Parameters===
| |
|
| |
| {|class="wikitable"
| |
| |-
| |
| ! Name
| |
| ! Type
| |
| ! Description
| |
| |-
| |
| | srcImage
| |
| | CuviImage*
| |
| | Input 3-channel image
| |
| |-
| |
| | dstImage
| |
| | CuviImage*
| |
| | Output single channel image
| |
| |-
| |
| | coeffs[3]
| |
| | Cuvi32f
| |
| | Transform coefficients
| |
| |-
| |
| | stream
| |
| | CuviStream*
| |
| | GPU stream ID for execution
| |
|
| |
| |}
| |
|
| |
|
| |
|
| |
| ===Image Type Support===
| |
|
| |
| {| class="wikitable"
| |
| |-
| |
| ! Input
| |
| ! Output
| |
| |-
| |
| | 8uC3
| |
| | 8uC1
| |
| |-
| |
| | 16uC3
| |
| | 16uC1
| |
| |}
| |
|
| |
| ===Sample===
| |
| {|
| |
| |-
| |
| |[[File:ColoIn.jpg|frame|Color Image]]
| |
| |[[File:Color2grayOut.jpg|frame|Output Gray 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,1);
| |
|
| |
| gimg->upload(img->imageData,img->widthStep);
| |
|
| |
| //Transform coefficients
| |
| float* coff = new float[3];
| |
| coff[0]= 0.3f;
| |
| coff[1]= 0.59f;
| |
| coff[2]= 0.11f;
| |
|
| |
|
| |
| //function call
| |
| cuvi::colorOperations::color2Gray(gimg,gout,coff);
| |
|
| |
| </syntaxhighlight>
| |
| |}
| |