Difference between revisions of "Function:RGB2Gray"
From CUVI Wiki
(Created page with "__NOTOC__ Converts an RGB image to gray scale using fixed transform coefficients ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus rgb2Gray(C...") |
|||
(11 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
Converts an RGB image to gray scale using fixed transform coefficients | Converts an RGB image to gray scale using fixed or custom transform coefficients | ||
===Function=== | ====Function==== | ||
{| | {| | ||
|style="font-size: | |style="font-size:100%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
CuviStatus | CuviStatus rgb2gray(const CuviImage& src, | ||
CuviImage | CuviImage& dst, | ||
CuviStream | const CuviStream& stream = CuviStream()); | ||
CuviStatus rgb2gray(const CuviImage& src, | |||
CuviImage& dst, | |||
const CuviScalar& coeffs, | |||
const CuviStream& stream = CuviStream()); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
====Parameters==== | |||
===Parameters=== | {| | ||
|style="font-size:75%;"| | |||
{|class="wikitable" | {|class="wikitable" | ||
|- | |- | ||
Line 20: | Line 26: | ||
! Description | ! Description | ||
|- | |- | ||
| | | src | ||
| CuviImage | | CuviImage& | ||
| Input 3 | | Input 3 channel image | ||
|- | |- | ||
| | | dst | ||
| CuviImage | | CuviImage& | ||
| Output single channel image | | Output single channel image | ||
|- | |||
| coeffs | |||
| CuviScalar& | |||
| Custom transformation coefficients | |||
|- | |- | ||
| stream | | stream | ||
| CuviStream | | 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 48: | Line 57: | ||
| 16uC3 | | 16uC3 | ||
| 16uC1 | | 16uC1 | ||
|- | |||
| 32fC3 | |||
| 32fC1 | |||
|} | |} | ||
|} | |} | ||
====Sample==== | |||
[[File:ColoIn.jpg|none|frame|Color Image]] | |||
<br/> | |||
[[File:RGB2GrayOut.jpg|none|frame|Output Gray Image]] | |||
<br/> | |||
====Example==== | |||
===Example=== | |||
{| | {| | ||
|style="font-size: | |style="font-size:100%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
CuviImage | CuviImage gimg = cuvi::io::loadImage(path), gout; | ||
// | //Convert to gray-scale using standard coefficients | ||
cuvi::colorOperations:: | cuvi::colorOperations::rgb2gray(gimg,gout); | ||
//Convert to gray-scale using custom coefficients | |||
CuviScalar coeffs(0.33, 0.33, 0.33); | |||
cuvi::colorOperations::rgb2gray(gimg,gout, coeffs); | |||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} |
Latest revision as of 21:09, 18 October 2022
Converts an RGB image to gray scale using fixed or custom transform coefficients
Function
|
Parameters
|
Image Type Support
|
Sample
Error creating thumbnail: Unable to save thumbnail to destination
Error creating thumbnail: Unable to save thumbnail to destination
Example
|