Difference between revisions of "Function:Rotate"

From CUVI Wiki
Line 5: Line 5:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus rotate(CuviImage* srcImage,  
CuviStatus rotate(const CuviImage& src,  
                   CuviImage* dstImage,
                   CuviImage& dst,
                   Cuvi32f angle,
                   const Cuvi32f angle,
                   CuviRotationType type = CUVI_ROTATE_CENTER,
                   const CuviRotationType type = CUVI_ROTATE_CENTER,
                   CuviStream* stream = NULL);
                   const CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 22: Line 22:
! Description
! Description
|-
|-
| srcImage
| src
| CuviImage*
| const CuviImage&
| Input image
| Input image
|-
|-
| dstImage
| dst
| CuviImage*
| CuviImage&
| Output image
| Output image
|-
|-
| angle
| angle
| Cuvi32f
| const Cuvi32f
| Angle of rotation
| Angle of rotation
|-
|-
| type  
| type  
| CuviRotationType
| const CuviRotationType
| Supports:  
| Supports:  
{|
{|
Line 44: Line 44:
|-
|-
| stream
| stream
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution


Line 63: Line 63:
| 8uC3
| 8uC3
| 8uC3
| 8uC3
|-
| 16uC1
| 16uC1
|-
| 16uC3
| 16uC3
|-
| 32fC1
| 32fC1
|-
| 32fC3
| 32fC3
|}
|}


Line 79: Line 91:
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">


CuviImage* gimg = new CuviImage(size,img->depth,img->nChannels);
CuviImage gimg = cuvi::io::loadImage(path), gout;
CuviImage* gout = new CuviImage(size,img->depth,img->nChannels);
 
//Populating GPU input image
gimg->upload(img->imageData,img->widthStep);
 


//function call
//function call

Revision as of 17:15, 19 April 2013

Rotates an image about origin (0,0) or center

Function

CuviStatus rotate(const CuviImage& src, 
                  CuviImage& dst,
                  const Cuvi32f angle,
                  const CuviRotationType type = CUVI_ROTATE_CENTER,
                  const CuviStream& stream = CuviStream());


Parameters

Name Type Description
src const CuviImage& Input image
dst CuviImage& Output image
angle const Cuvi32f Angle of rotation
type const CuviRotationType Supports:
CUVI_ROTATE_CENTER
CUVI_ROTATE_ORIGIN
stream const CuviStream& GPU stream ID for execution


Image Type Support

Input Output
8uC1 8uC1
8uC3 8uC3
16uC1 16uC1
16uC3 16uC3
32fC1 32fC1
32fC3 32fC3

Sample

Error creating thumbnail: Unable to save thumbnail to destination
Input Image
Error creating thumbnail: Unable to save thumbnail to destination
Rotated at 45 degrees about center


Example

CuviImage gimg = cuvi::io::loadImage(path), gout;

//function call
cuvi::geometryTransforms::rotate(gimg, gout, 45.0f);