https://wiki.cuvilib.com/index.php?title=Function:ConvertScale&feed=atom&action=history
Function:ConvertScale - Revision history
2024-03-28T13:04:04Z
Revision history for this page on the wiki
MediaWiki 1.37.1
https://wiki.cuvilib.com/index.php?title=Function:ConvertScale&diff=818&oldid=prev
Ghazanfar: Created page with "__NOTOC__ Converts image data type with optional scaling. ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus convertScale(const CuviImage& src..."
2014-06-13T11:20:51Z
<p>Created page with "__NOTOC__ Converts image data type with optional scaling. ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus convertScale(const CuviImage& src..."</p>
<p><b>New page</b></p><div>__NOTOC__<br />
Converts image data type with optional scaling.<br />
===Function===<br />
{|<br />
|style="font-size:150%;"|<br />
<syntaxhighlight lang="cpp"><br />
CuviStatus convertScale(const CuviImage& src,<br />
CuviImage& dst,<br />
const Cuvi32f scale = 1.0f,<br />
const Cuvi32f offset = 0.0f,<br />
const CuviStream& stream = CuviStream());<br />
</syntaxhighlight><br />
|}<br />
===Parameters===<br />
<br />
{|class="wikitable"<br />
|-<br />
! Name <br />
! Type <br />
! Description<br />
|-<br />
| src<br />
| const CuviImage&<br />
| Input Image<br />
|-<br />
| dst<br />
| CuviImage&<br />
| Destination Image<br />
|-<br />
| scale<br />
| const Cuvi32f<br />
| Scale factor<br />
|-<br />
| offset<br />
| const Cuvi32f<br />
| Value added to scaled values<br />
|-<br />
| stream <br />
| const CuviStream&<br />
| GPU stream ID for execution<br />
<br />
|}<br />
<br />
===Image Type Support===<br />
<br />
{| class="wikitable"<br />
|-<br />
! Input<br />
! Output<br />
|-<br />
| 8u<br />
| 8u<br />
|-<br />
| 16u<br />
| 16u<br />
|-<br />
| 32f<br />
| 32f<br />
|-<br />
| 8u<br />
| 32f<br />
|-<br />
| 16u<br />
| 32f<br />
|-<br />
| 8u<br />
| 16u<br />
|-<br />
| 32f<br />
| 8u<br />
|-<br />
| 32f<br />
| 16u<br />
|-<br />
| 16u<br />
| 8u<br />
|}<br />
<br />
<br />
===Example===<br />
{|<br />
|style="font-size:150%;"|<br />
<syntaxhighlight lang="cpp"><br />
<br />
<br />
//Creating input images<br />
CuviImage input = cuvi:io::loadImage(path);<br />
<br />
//Create output image of same size but different type<br />
CuviImage output(input.size(), CUVI_DEPTH_32F, input.channels());<br />
<br />
//Convert image by normalizing pixel values (divide each pixel by 255)<br />
cuvi::dataExchange::convertScale(input, output, 1.0f/255.0f);<br />
<br />
</syntaxhighlight><br />
|}</div>
Ghazanfar