Function:Multiply

From CUVI Wiki
Revision as of 14:43, 13 June 2014 by Ghazanfar (talk | contribs)

Multiplies image with another image or constant value(s).

Function

CuviStatus multiply(const CuviImage& src1,
                    const CuviImage& src2,
                    CuviImage& dst,
                    const CuviStream& stream = CuviStream());

CuviStatus multiply(const CuviImage& src,
                    const CuviScalar& values,
                    CuviImage& dst,
                    const CuviStream& stream = CuviStream());

CuviStatus multiply(const CuviImage& src,
                    const Cuvi64f value,
                    CuviImage& dst,
                    const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src1 const CuviImage& First Input Image
src2 const CuviImage& Second Input Image
dst CuviImage& Resultant Image
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input 1 Input 2 Output
8u 8u 8u
16u 16u 16u
32f 32f 32f
8u 8u 16u
8u 8u 32f
16u 16u 32f
8u 16u 16u
16u 8u 16u
8u 32f 32f
32f 8u 32f
8u 16u 32f
16u 8u 32f
16u 32f 32f
32f 16u 32f

Sample

Error creating thumbnail: Unable to save thumbnail to destination
First Input Image (8-bit)
Error creating thumbnail: Unable to save thumbnail to destination
Second Input Image (8-bit)
Error creating thumbnail: Unable to save thumbnail to destination
Resultant Image (16-bit)

Example

CuviImage gimg1 = cuvi::io::loadImage(path);
CuviImage gimg2 = cuvi::io::loadImage(path);

CuviImage gout;

//Multiply
cuvi::arithmeticLogical::multiply(gimg1,gimg2,gout);

//Multiply with a constant value
gout *= 4;

//Multiply each channel with a different value
gout *= CuviScalar(3,5,6);