Difference between revisions of "Function:Crop"
From CUVI Wiki
| (2 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
__NOTOC__ | __NOTOC__ | ||
Crops the desired portion of an image | |||
===Function=== | ===Function=== | ||
{| | {| | ||
|style="font-size:150%;"| | |style="font-size:150%;"| | ||
<syntaxhighlight lang="cpp"> | <syntaxhighlight lang="cpp"> | ||
CuviStatus crop(CuviImage | CuviStatus crop(const CuviImage& src, | ||
CuviImage | CuviImage& dst, | ||
Cuvi32s top, | Cuvi32s top, | ||
Cuvi32s bottom, | Cuvi32s bottom, | ||
Cuvi32s left, | Cuvi32s left, | ||
Cuvi32s right, | Cuvi32s right, | ||
CuviStream | const CuviStream& stream = CuviStream()); | ||
</syntaxhighlight> | </syntaxhighlight> | ||
|} | |} | ||
| Line 22: | Line 22: | ||
! Description | ! Description | ||
|- | |- | ||
| | | src | ||
| CuviImage | | const CuviImage& | ||
| Input Image | | Input Image | ||
|- | |- | ||
| | | dst | ||
| CuviImage | | CuviImage& | ||
| Output Image | | Output Image | ||
|- | |- | ||
| top | | top | ||
| | | const Cuvi32s | ||
| Number of pixels to cut from top | | Number of pixels to cut from top | ||
|- | |- | ||
| bottom | | bottom | ||
| | | const Cuvi32s | ||
| Number of pixels to cut from bottom | | Number of pixels to cut from bottom | ||
|- | |- | ||
| left | | left | ||
| | | const Cuvi32s | ||
| Number of pixels to cut from left | | Number of pixels to cut from left | ||
|- | |- | ||
| right | | right | ||
| | | const Cuvi32s | ||
| Number of pixels to cut from right | | Number of pixels to cut from right | ||
|- | |- | ||
| stream | | stream | ||
| CuviStream | | const CuviStream& | ||
| GPU stream ID for execution | | GPU stream ID for execution | ||
| Line 86: | Line 86: | ||
gimg = | CuviImage gimg = cuvi::io::loadImage(path), gout; | ||
gout | |||
//Cropping parameters | //Cropping parameters | ||
int top = 20, bottom = 20, left = 5, right = 10; | const int top = 20, bottom = 20, left = 5, right = 10; | ||
//crop. Output image size must conform to cropped size | //crop. Output image size must conform to cropped size | ||
Latest revision as of 09:09, 30 June 2019
Crops the desired portion of an image
Function
|
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
Example
|

