Function:Crop

From CUVI Wiki
Jump to: navigation, search

rops the desired portion of an image

Function

CuviStatus crop(const CuviImage& src,
                CuviImage& dst,
                Cuvi32s top,
                Cuvi32s bottom,
                Cuvi32s left,
                Cuvi32s right,
                const CuviStream& stream = CuviStream());

Parameters

Name Type Description
src const CuviImage& Input Image
dst CuviImage& Output Image
top const Cuvi32s Number of pixels to cut from top
bottom const Cuvi32s Number of pixels to cut from bottom
left const Cuvi32s Number of pixels to cut from left
right const Cuvi32s Number of pixels to cut from right
stream const CuviStream& GPU stream ID for execution

Image Type Support

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

Sample

Input
Cropped


Example

CuviImage gimg = cuvi::io::loadImage(path), gout;
 
//Cropping parameters
const int top = 20, bottom = 20, left = 5, right = 10;
 
//crop. Output image size must conform to cropped size
cuvi::geometryTransforms::crop(gimg,gout,top,bottom,left,right);