Difference between revisions of "Function:ImageGradients"

From CUVI Wiki
(Created page with "__NOTOC__ Calculates X and Y gradients of image ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus imageGradients(CuviImage* srcImage, ...")
 
Line 72: Line 72:
{|
{|
|-
|-
|[[File:FlipIn.jpg|frame|Input Image]]
|[[File:Ferrari.jpg|frame|Input Image]]
|[[File:FlipOut.jpg|frame|Output Image]]
|-
|[[File:FerrariX.jpg|frame|Sobel X, 3x3]]
|[[File:FerrariY.jpg|frame|Sobel Y, 3x3]]
|}
|}



Revision as of 14:21, 8 May 2012

Calculates X and Y gradients of image

Function

CuviStatus imageGradients(CuviImage* srcImage,
                          CuviImage* dstX,
                          CuviImage* dstY,
                          CuviGradientKernelType type = CUVI_GRADIENT_SOBEL_3x3,
                          CuviStream* stream = NULL);


Parameters

Name Type Description
srcImage CuviImage* Input image
dstX CuviImage* Horizontal image gradient
dstY CuviImage* Vertical image gradient
type CuviGradientKernelType Supports:
CUVI_GRADIENT_CENTRAL_DIFFERENCE
CUVI_GRADIENT_SOBEL_3x3
CUVI_GRADIENT_SOBEL_5x5
CUVI_GRADIENT_SCHARR_3x3
stream CuviStream* GPU stream ID for execution


Image Type Support

Input Output
8uC1 32fC1
8uC3 32fC3

Sample

Error creating thumbnail: Unable to save thumbnail to destination
Input Image
Error creating thumbnail: Unable to save thumbnail to destination
Sobel X, 3x3
Error creating thumbnail: Unable to save thumbnail to destination
Sobel Y, 3x3


Example

//Container for input Image
CuviImage* gimg = new CuviImage(size,depth,nChannels);

//Containers for gradients
CuviImage* gX = new CuviImage(size,32,nChannels);
CuviImage* gY = new CuviImage(size,32,nChannels);

//Populating GPU input image
gimg->upload(hostImg->imageData, hostImg->widthStep);


//function call
cuvi::computerVision::imageGradients(gimg,gX,gY,CUVI_GRADIENT_CENTRAL_DIFFERENCE);