Difference between revisions of "Function:MinFilter"

From CUVI Wiki
 
(One intermediate revision by the same user not shown)
Line 5: Line 5:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus minFilter(CuviImage* srcImage,
CuviStatus minFilter(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&
| Min filter's kernel size
| Min 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 Min 5x5 filter
//Applying Min filter of size 5x5 on the image
cuvi::imageFiltering::minFilter(gimg, gout, roi, fSize);
cuvi::imageFiltering::minFilter(gimg, gout, roi, fSize);


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

Latest revision as of 14:51, 19 April 2013

Filters an image using a min filter and default Anchor Position

Function

CuviStatus minFilter(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& Min 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
Min 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 Min filter of size 5x5 on the image
cuvi::imageFiltering::minFilter(gimg, gout, roi, fSize);