Function:ImageGradients

From CUVI Wiki
Revision as of 06:21, 8 May 2012 by Jawad (talk | contribs)

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

Input Image
Sobel X, 3x3
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);