Function:ImageGradients

From CUVI Wiki
Jump to: navigation, search

Calculates X and Y gradients of image

Function

CuviStatus imageGradients(const CuviImage& src,
                          CuviImage& gradX,
                          CuviImage& gradY,
                          const CuviGradientKernelType type = CUVI_GRADIENT_SOBEL_3x3,
                          const CuviStream& stream = CuviStream());


Parameters

Name Type Description
src const CuviImage& Input image
gradX CuviImage& Horizontal image gradient
gradY CuviImage& Vertical image gradient
type const CuviGradientKernelType Supports:
CUVI_GRADIENT_CENTRAL_DIFFERENCE
CUVI_GRADIENT_SOBEL_3x3
CUVI_GRADIENT_SOBEL_5x5
CUVI_GRADIENT_SCHARR_3x3
stream const 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 = cuvi::io::loadImage(path);
 
//Containers for gradients
CuviImage gX, gY;
 
 
//function call
cuvi::imageFiltering::imageGradients(gimg,gX,gY,CUVI_GRADIENT_CENTRAL_DIFFERENCE);