Difference between revisions of "Function:MaxFilter"

From CUVI Wiki
Line 5: Line 5:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus maxFilter(CuviImage* srcImage,
CuviStatus maxFilter(const CuviImage& src,
                     CuviImage* dstImage,
                     CuviImage& dst,
                     CuviROI roi,
                     const CuviRect& roi,
                     CuviSize filterSize,
                     const CuviSize& filterSize,
                     CuviStream* stream = NULL);
                     const CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 20: Line 20:
! Description
! Description
|-
|-
| srcImage
| src
| CuviImage*
| const CuviImage&
| Input Image
| Input Image
|-
|-
| dstImage
| dst
| CuviImage*
| CuviImage&
| Output Image
| Output Image
|-
|-
| roi
| roi
| CuviROI
| const CuviRect&
| Region of Interest
| Region of Interest
|-
|-
| filterSize
| filterSize
| CuviSize
| const CuviSize&
| Max filter's kernel size
| Max filter's kernel size
|-
|-
| stream  
| stream  
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution


Line 78: Line 78:


//Input image
//Input image
CuviImage* gimg = new CuviImage(cuviSize(img->width,img->height),img->depth,img->nChannels);
CuviImage gimg = cuvi::io::loadImage(path);
gimg->upload(img->imageData,img->widthStep);


//Output Image
//Output Image
CuviImage* gout = new CuviImage(cuviSize(img->width,img->height),img->depth,img->nChannels);
CuviImage gout;


//Choosing ROI
//Choosing ROI
CuviROI roi = cuviROI(0,0,img->width,img->height);
CuviRect roi(0,0,img->width,img->height);


//Filter Size
//Filter Size
CuviSize fSize = cuviSize(5,5);
CuviSize fSize(5,5);


//Applying Max filter of size 5x5 on the image
//Applying Max filter of size 5x5 on the image

Revision as of 13:32, 19 April 2013

Filters an image using a max filter and default Anchor Position

Function

CuviStatus maxFilter(const CuviImage& src,
                     CuviImage& dst,
                     const CuviRect& roi,
                     const CuviSize& filterSize,
                     const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
dst CuviImage& Output Image
roi const CuviRect& Region of Interest
filterSize const CuviSize& Max filter's kernel size
stream const CuviStream& GPU stream ID for execution

Image Type Support

Input Output
8uC1 8uC1
8uC3 8uC3
16uC1 16uC1
16uC3 16uC3


Sample

Error creating thumbnail: Unable to save thumbnail to destination
Input
Error creating thumbnail: Unable to save thumbnail to destination
Max 5x5


Example

//Input image
CuviImage gimg = cuvi::io::loadImage(path);

//Output Image
CuviImage gout;

//Choosing ROI
CuviRect roi(0,0,img->width,img->height);

//Filter Size
CuviSize fSize(5,5);

//Applying Max filter of size 5x5 on the image
cuvi::imageFiltering::maxFilter(gimg, gout, roi, fSize);