SampleImage2d
Performs a subsampling of a two-dimensional image.
Access to parameter description
The SampleImage2d algorithm subsamples an image by an integer factor for the X and Y coordinates. For example, specifying integer factors of 4 and 8 generates an output image retaining the value of one pixel out of four in the X axis direction and one out of eight in the Y axis direction.
See also
Access to parameter description
The SampleImage2d algorithm subsamples an image by an integer factor for the X and Y coordinates. For example, specifying integer factors of 4 and 8 generates an output image retaining the value of one pixel out of four in the X axis direction and one out of eight in the Y axis direction.
See also
Function Syntax
This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > sampleImage2d( std::shared_ptr< iolink::ImageView > inputImage, int32_t sampleFactorX, int32_t sampleFactorY, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype. sample_image_2d( input_image, sample_factor_x = 2, sample_factor_y = 2, output_image = None )
This function returns outputImage.
// Function prototype. public static IOLink.ImageView SampleImage2d( IOLink.ImageView inputImage, Int32 sampleFactorX = 2, Int32 sampleFactorY = 2, IOLink.ImageView outputImage = null );
Class Syntax
Parameters
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
sampleFactorX |
The X axis sampling factor. | Int32 | >=1 | 2 | |
sampleFactorY |
The Y axis sampling factor. | Int32 | >=1 | 2 | |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | nullptr | |
outputImage |
The output image. Its dimensions are equal to the input image dimensions divided by the sampling factor in each direction. | Image | nullptr |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
sample_factor_x |
The X axis sampling factor. | int32 | >=1 | 2 | |
sample_factor_y |
The Y axis sampling factor. | int32 | >=1 | 2 | |
input_image |
The input image. | image | Binary, Label, Grayscale or Multispectral | None | |
output_image |
The output image. Its dimensions are equal to the input image dimensions divided by the sampling factor in each direction. | image | None |
Parameter Name | Description | Type | Supported Values | Default Value | |
---|---|---|---|---|---|
sampleFactorX |
The X axis sampling factor. | Int32 | >=1 | 2 | |
sampleFactorY |
The Y axis sampling factor. | Int32 | >=1 | 2 | |
inputImage |
The input image. | Image | Binary, Label, Grayscale or Multispectral | null | |
outputImage |
The output image. Its dimensions are equal to the input image dimensions divided by the sampling factor in each direction. | Image | null |
Object Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); SampleImage2d sampleImage2dAlgo; sampleImage2dAlgo.setInputImage( polystyrene ); sampleImage2dAlgo.setSampleFactorX( 2 ); sampleImage2dAlgo.setSampleFactorY( 2 ); sampleImage2dAlgo.execute(); std::cout << "outputImage:" << sampleImage2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) sample_image_2d_algo = imagedev.SampleImage2d() sample_image_2d_algo.input_image = polystyrene sample_image_2d_algo.sample_factor_x = 2 sample_image_2d_algo.sample_factor_y = 2 sample_image_2d_algo.execute() print( "output_image:", str( sample_image_2d_algo.output_image ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); SampleImage2d sampleImage2dAlgo = new SampleImage2d { inputImage = polystyrene, sampleFactorX = 2, sampleFactorY = 2 }; sampleImage2dAlgo.Execute(); Console.WriteLine( "outputImage:" + sampleImage2dAlgo.outputImage.ToString() );
Function Examples
std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" ); auto result = sampleImage2d( polystyrene, 2, 2 ); std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif")) result = imagedev.sample_image_2d( polystyrene, 2, 2 ) print( "output_image:", str( result ) )
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" ); IOLink.ImageView result = Processing.SampleImage2d( polystyrene, 2, 2 ); Console.WriteLine( "outputImage:" + result.ToString() );