BRL-CAD

Functions for cropping images. More...

Collaboration diagram for Crop Image:

Files

file  crop.h
 

Functions

int icv_rect (icv_image_t *img, size_t xorig, size_t yorig, size_t xnum, size_t ynum)
 
int icv_crop (icv_image_t *img, size_t ulx, size_t uly, size_t urx, size_t ury, size_t lrx, size_t lry, size_t llx, size_t lly, size_t ynum, size_t xnum)
 

Detailed Description

Functions for cropping images.

There are currently two types of cropping: rectangular and skewed.

Function Documentation

◆ icv_rect()

int icv_rect ( icv_image_t img,
size_t  xorig,
size_t  yorig,
size_t  xnum,
size_t  ynum 
)

This function crops an input image. Note : (0,0) corresponds to the Bottom Left of an Image.

Parameters
imgInput image struct to be cropped.
xorigX-Coordinate of offset of image to be extracted from.
yorigY-Coordinate of offset of image to be extracted from.
xnumLength of the output image to be extracted from input data in horizontal direction.
ynumLength of the output image to be extracted from input data in vertical direction.
Returns
0 on success.

◆ icv_crop()

int icv_crop ( icv_image_t img,
size_t  ulx,
size_t  uly,
size_t  urx,
size_t  ury,
size_t  lrx,
size_t  lry,
size_t  llx,
size_t  lly,
size_t  ynum,
size_t  xnum 
)

This function crops an input image.

This can do a skewed cropping, i.e. given any four points of quadrilateral in an image, map it to a rectangle of xnumXynum dimension.

*        (ulx,uly)         (urx,ury)
*             __________________
*            /                 |
*           /                  |
*          /                   |
*         /                    |
*        /                     |
*       /______________________|
*     (llx,lly)             (lrx,lry)
* 
Returns
0 on success; on failure -1; and logs the error message.