<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.cuvilib.com/index.php?action=history&amp;feed=atom&amp;title=Function%3AConvertScale</id>
	<title>Function:ConvertScale - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.cuvilib.com/index.php?action=history&amp;feed=atom&amp;title=Function%3AConvertScale"/>
	<link rel="alternate" type="text/html" href="https://wiki.cuvilib.com/index.php?title=Function:ConvertScale&amp;action=history"/>
	<updated>2026-08-15T20:19:46Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.37.1</generator>
	<entry>
		<id>https://wiki.cuvilib.com/index.php?title=Function:ConvertScale&amp;diff=818&amp;oldid=prev</id>
		<title>Ghazanfar: Created page with &quot;__NOTOC__ Converts image data type with optional scaling. ===Function=== {| |style=&quot;font-size:150%;&quot;| &lt;syntaxhighlight lang=&quot;cpp&quot;&gt; CuviStatus convertScale(const CuviImage&amp; src...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.cuvilib.com/index.php?title=Function:ConvertScale&amp;diff=818&amp;oldid=prev"/>
		<updated>2014-06-13T11:20:51Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;__NOTOC__ Converts image data type with optional scaling. ===Function=== {| |style=&amp;quot;font-size:150%;&amp;quot;| &amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt; CuviStatus convertScale(const CuviImage&amp;amp; src...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;__NOTOC__&lt;br /&gt;
Converts image data type with optional scaling.&lt;br /&gt;
===Function===&lt;br /&gt;
{|&lt;br /&gt;
|style=&amp;quot;font-size:150%;&amp;quot;|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
CuviStatus convertScale(const CuviImage&amp;amp; src,&lt;br /&gt;
                        CuviImage&amp;amp; dst,&lt;br /&gt;
                        const Cuvi32f scale = 1.0f,&lt;br /&gt;
                        const Cuvi32f offset = 0.0f,&lt;br /&gt;
                        const CuviStream&amp;amp; stream = CuviStream());&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;br /&gt;
===Parameters===&lt;br /&gt;
&lt;br /&gt;
{|class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Name	&lt;br /&gt;
! Type	&lt;br /&gt;
! Description&lt;br /&gt;
|-&lt;br /&gt;
| src&lt;br /&gt;
| const CuviImage&amp;amp;&lt;br /&gt;
| Input Image&lt;br /&gt;
|-&lt;br /&gt;
| dst&lt;br /&gt;
| CuviImage&amp;amp;&lt;br /&gt;
| Destination Image&lt;br /&gt;
|-&lt;br /&gt;
| scale&lt;br /&gt;
| const Cuvi32f&lt;br /&gt;
| Scale factor&lt;br /&gt;
|-&lt;br /&gt;
| offset&lt;br /&gt;
| const Cuvi32f&lt;br /&gt;
| Value added to scaled values&lt;br /&gt;
|-&lt;br /&gt;
| stream &lt;br /&gt;
| const CuviStream&amp;amp;&lt;br /&gt;
| GPU stream ID for execution&lt;br /&gt;
&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
===Image Type Support===&lt;br /&gt;
&lt;br /&gt;
{| class=&amp;quot;wikitable&amp;quot;&lt;br /&gt;
|-&lt;br /&gt;
! Input&lt;br /&gt;
! Output&lt;br /&gt;
|-&lt;br /&gt;
| 8u&lt;br /&gt;
| 8u&lt;br /&gt;
|-&lt;br /&gt;
| 16u&lt;br /&gt;
| 16u&lt;br /&gt;
|-&lt;br /&gt;
| 32f&lt;br /&gt;
| 32f&lt;br /&gt;
|-&lt;br /&gt;
| 8u&lt;br /&gt;
| 32f&lt;br /&gt;
|-&lt;br /&gt;
| 16u&lt;br /&gt;
| 32f&lt;br /&gt;
|-&lt;br /&gt;
| 8u&lt;br /&gt;
| 16u&lt;br /&gt;
|-&lt;br /&gt;
| 32f&lt;br /&gt;
| 8u&lt;br /&gt;
|-&lt;br /&gt;
| 32f&lt;br /&gt;
| 16u&lt;br /&gt;
|-&lt;br /&gt;
| 16u&lt;br /&gt;
| 8u&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
===Example===&lt;br /&gt;
{|&lt;br /&gt;
|style=&amp;quot;font-size:150%;&amp;quot;|&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;cpp&amp;quot;&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
//Creating input images&lt;br /&gt;
CuviImage input = cuvi:io::loadImage(path);&lt;br /&gt;
&lt;br /&gt;
//Create output image of same size but different type&lt;br /&gt;
CuviImage output(input.size(), CUVI_DEPTH_32F, input.channels());&lt;br /&gt;
&lt;br /&gt;
//Convert image by normalizing pixel values (divide each pixel by 255)&lt;br /&gt;
cuvi::dataExchange::convertScale(input, output, 1.0f/255.0f);&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
|}&lt;/div&gt;</summary>
		<author><name>Ghazanfar</name></author>
	</entry>
</feed>