Difference between revisions of "Function:MinFilter"

From CUVI Wiki
(Created page with "__NOTOC__ Filters an image using a min filter and default Anchor Position ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus minFilter(CuviIma...")
 
 
(2 intermediate revisions 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 66: Line 66:
{|
{|
|-
|-
|[[File:Filterinc.jpg‎|frame|Input]]
|[[File:Color_window.jpg‎|frame|Input]]
|[[File:Filtera55.jpg|frame|Average 5x5]]
|[[File:Min5x5_out.jpg|frame|Min 5x5]]


|}
|}
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());


//Creating a 5x5 Averaging Filter. User can also enter custom coefficients
//Filter Size
CuviFilter* f;
CuviSize  fSize(5,5);
cuviCreateFilter(&f,5,5);
cuviCreateFilterSpecial(f,CUVI_FILTER_AVERAGE);


//Applying filter 'f' on the image
//Applying Min filter of size 5x5 on the image
cuvi::imageFiltering::imFilter(gimg,gout,roi,f);
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);