Difference between revisions of "Function:HaarFwd"

From CUVI Wiki
Line 71: Line 71:
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">


//A single color image
//Input Image
CuviImage *gimg = new CuviImage(_size,img->depth,img->nChannels);
CuviImage *gimg = new CuviImage(size,img->depth,img->nChannels);


//Three single channel images for storing output
//Four output images
CuviImage *gr = new CuviImage(_size,img->depth,1);
CuviImage *a = new CuviImage(sizeHalf,32,1);
CuviImage *gg = new CuviImage(_size,img->depth,1);
CuviImage *x = new CuviImage(sizeHalf,32,1);
CuviImage *gb = new CuviImage(_size,img->depth,1);
CuviImage *y = new CuviImage(sizeHalf,32,1);
CuviImage *xy = new CuviImage(sizeHalf,32,1);


//Populate the GPU image with pixel data
//Populate the GPU image with pixel data
gimg->upload(img->imageData,img->widthStep);
gimg->upload(img->imageData,img->widthStep);


//Split into R, G and B channels
//compute one-level haar wavelet decomposition
CuviStatus st = cuvi::colorOperations::channelSplit(gimg,gr,gg,gb);
cuvi::imageTransforms::haarFwd(gimg,a,x,y,xy);


</syntaxhighlight>
</syntaxhighlight>
|}
|}

Revision as of 13:11, 8 May 2012

Performs one-level wavelet decomposition of an image using haar basis. The four resultant images are half the width and half the height of the original image

Function

CuviStatus haarFwd(CuviImage* srcImage,
                   CuviImage* dstApprox,
                   CuviImage* dstDetailX,
                   CuviImage* dstDetailY,
                   CuviImage* dstDetailXY,
                   CuviStream* stream = NULL);

Parameters

Name Type Description
srcImage CuviImage* Input image
dstApprox CuviImage* Output approximation image
dstDetailX CuviImage* Output horizontal detail image
dstDetailY CuviImage* Output vertical detail image
dstDetailXY CuviImage* Output diagonal detail image
stream CuviStream* GPU stream ID for execution

Image Type Support

Input Output
8uC1 32fC1 x 4

Sample

File:Haar.jpg


Example

//Input Image
CuviImage *gimg = new CuviImage(size,img->depth,img->nChannels);

//Four output images
CuviImage *a = new CuviImage(sizeHalf,32,1);
CuviImage *x = new CuviImage(sizeHalf,32,1);
CuviImage *y = new CuviImage(sizeHalf,32,1);
CuviImage *xy = new CuviImage(sizeHalf,32,1);

//Populate the GPU image with pixel data
gimg->upload(img->imageData,img->widthStep);

//compute one-level haar wavelet decomposition
cuvi::imageTransforms::haarFwd(gimg,a,x,y,xy);