Function:Crop

From CUVI Wiki
Revision as of 09:58, 26 April 2012 by Jawad (talk | contribs) (Created page with "__NOTOC__ rops the desired portion of an image ===Function=== {| |style="font-size:150%;"| <syntaxhighlight lang="cpp"> CuviStatus crop(CuviImage* srcImage, Cu...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

rops the desired portion of an image

Function

CuviStatus crop(CuviImage* srcImage,
                CuviImage* dstImage,
                Cuvi32s top,
                Cuvi32s bottom,
                Cuvi32s left,
                Cuvi32s right,
                CuviStream* stream = NULL);

Parameters

Name Type Description
srcImage CuviImage* Input Image
dstImage CuviImage* Output Image
top Cuvi32u Number of pixels to cut from top
bottom Cuvi32u Number of pixels to cut from bottom
left Cuvi32u Number of pixels to cut from left
right Cuvi32u Number of pixels to cut from right
stream CuviStream* GPU stream ID for execution

Image Type Support

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

Sample

Input
Cropped


Example

gimg = new CuviImage(size_in,img->depth,img->nChannels);
gout = new CuviImage(size_out,img->depth,img->nChannels);

gimg->upload(img->imageData,img->widthStep);

//Cropping parameters
int top = 20, bottom = 20, left = 10, right = 30;

//crop. Output image size must conform to cropped size
cuvi::geometryTransforms::crop(gimg,gout,top,bottom,left,right);