Function:ConvertScale
Jump to navigation
Jump to search
Converts image data type with optional scaling.
Function
CuviStatus convertScale(const CuviImage& src,
CuviImage& dst,
const Cuvi32f scale = 1.0f,
const Cuvi32f offset = 0.0f,
const CuviStream& stream = CuviStream()); |
Parameters
Name | Type | Description |
---|---|---|
src | const CuviImage& | Input Image |
dst | CuviImage& | Destination Image |
scale | const Cuvi32f | Scale factor |
offset | const Cuvi32f | Value added to scaled values |
stream | const CuviStream& | GPU stream ID for execution |
Image Type Support
Input | Output |
---|---|
8u | 8u |
16u | 16u |
32f | 32f |
8u | 32f |
16u | 32f |
8u | 16u |
32f | 8u |
32f | 16u |
16u | 8u |
Example
//Creating input images
CuviImage input = cuvi:io::loadImage(path);
//Create output image of same size but different type
CuviImage output(input.size(), CUVI_DEPTH_32F, input.channels());
//Convert image by normalizing pixel values (divide each pixel by 255)
cuvi::dataExchange::convertScale(input, output, 1.0f/255.0f); |