Difference between revisions of "Function:BorderMask"

From CUVI Wiki
Jump to navigation Jump to search
 
(3 intermediate revisions by one other user not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
Adds borders on the input specified bythe 4 arguments: top, bottom, left and right. By default the masking value is 0 (black).
Adds borders on the input specified by the 4 arguments: top, bottom, left and right..


===Function===
===Function===
Line 6: Line 6:
|style="font-size:150%;"|
|style="font-size:150%;"|
<syntaxhighlight lang="cpp">
<syntaxhighlight lang="cpp">
CuviStatus borderMask(CuviImage* srcImage,
CuviStatus borderMask(const CuviImage& src,
                       CuviImage* dstImage,
                       CuviImage& dst,
                       Cuvi32u top,
                       const Cuvi32s top,
                       Cuvi32u bottom,
                       const Cuvi32s bottom,
                       Cuvi32u left,  
                       const Cuvi32s left,  
                       Cuvi32u right,
                       const Cuvi32s right,
                       Cuvi32u mask = 0,
                       const Cuvi32f* mask,
                       CuviStream* stream = NULL);
                       const CuviStream& stream = CuviStream());
</syntaxhighlight>
</syntaxhighlight>
|}
|}
Line 24: Line 24:
! Description
! Description
|-
|-
| srcImage
| src
| CuviImage*
| const CuviImage&
| Input Image
| Input Image
|-
|-
| dstImage
| dst
| CuviImage*
| CuviImage&
| Output Image
| Output Image
|-
|-
| top
| top
| Cuvi32u
| const Cuvi32s
| Number of pixels to mask from top
| Number of pixels to mask from top
|-
|-
| bottom
| bottom
| Cuvi32u
| const Cuvi32s
| Number of pixels to mask from bottom
| Number of pixels to mask from bottom
|-
|-
| left
| left
| Cuvi32u
| const Cuvi32s
| Number of pixels to mask from left
| Number of pixels to mask from left
|-
|-
| right
| right
| Cuvi32u
| const Cuvi32s
| Number of pixels to mask from right
| Number of pixels to mask from right
|-
| mask
| const Cuvi32f*
| Values of masked pixel for each channel
|-
|-
| stream  
| stream  
| CuviStream*
| const CuviStream&
| GPU stream ID for execution
| GPU stream ID for execution


Line 88: Line 92:




CuviImage* gimg = new CuviImage(size,img->depth,img->nChannels);
CuviImage gimg = cuvi::io::loadImage(path), gout;
CuviImage* gout = new CuviImage(size,img->depth,img->nChannels);


//Populate input image with pixel data
Cuvi32f mask[3] = { 0 };
gimg->upload(img->imageData,img->widthStep);


//Mask borders with pixel value of 0
//Mask borders with pixel value of 0 for each channel
cuvi::ColorOperations::borderMask(gimg,gout,10,10,5,3,0);
cuvi::colorOperations::borderMask(gimg,gout,10,10,5,3,mask);
</syntaxhighlight>
</syntaxhighlight>
|}
|}

Latest revision as of 14:06, 16 June 2014

Adds borders on the input specified by the 4 arguments: top, bottom, left and right..

Function

CuviStatus borderMask(const CuviImage& src,
                      CuviImage& dst,
                      const Cuvi32s top,
                      const Cuvi32s bottom,
                      const Cuvi32s left, 
                      const Cuvi32s right,
                      const Cuvi32f* mask,
                      const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
dst CuviImage& Output Image
top const Cuvi32s Number of pixels to mask from top
bottom const Cuvi32s Number of pixels to mask from bottom
left const Cuvi32s Number of pixels to mask from left
right const Cuvi32s Number of pixels to mask from right
mask const Cuvi32f* Values of masked pixel for each channel
stream const CuviStream& GPU stream ID for execution

Image Type Support

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

Sample

Input Image
Masked Image


Example

CuviImage gimg = cuvi::io::loadImage(path), gout;

Cuvi32f mask[3] = { 0 };

//Mask borders with pixel value of 0 for each channel
cuvi::colorOperations::borderMask(gimg,gout,10,10,5,3,mask);