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, ...")
(No difference)

Revision as of 13:32, 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
Output Image


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);