CropImage2d
Extracts a two-dimensional rectangular region from an image.
Access to parameter description
CropImage2d copies a rectangular area, defined by an origin and a size in pixels, from an input image I and creates an output image O from this selected region.
See also
Access to parameter description
CropImage2d copies a rectangular area, defined by an origin and a size in pixels, from an input image I and creates an output image O from this selected region.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > cropImage2d( std::shared_ptr< iolink::ImageView > inputImage, iolink::Vector2i32 areaOrigin, iolink::Vector2i32 areaSize, std::shared_ptr< iolink::ImageView > outputImage = NULL );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
![]() |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr |
![]() |
areaOrigin |
The origin of the area (the X and Y pixel coordinates of the input image corresponding to the output image origin). | Vector2i32 | >=0 | {1, 1} |
![]() |
areaSize |
The size, in pixels, of the area (the X and Y dimensions of the output image). | Vector2i32 | >0 | {100, 100} |
![]() |
outputImage |
The output image. | Image | nullptr |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); CropImage2d cropImage2dAlgo; cropImage2dAlgo.setInputImage( polystyrene ); cropImage2dAlgo.setAreaOrigin( {1, 1} ); cropImage2dAlgo.setAreaSize( {100, 100} ); cropImage2dAlgo.execute(); std::cout << "outputImage:" << cropImage2dAlgo.outputImage()->toString();
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = cropImage2d( polystyrene, {1, 1}, {100, 100} ); std::cout << "outputImage:" << result->toString();