ImageDev

BackgroundImage2d

Computes a background image from a grayscale image.

Access to parameter description

This algorithm estimates a background by interpolating all pixels contained in a binary mask by a second order polynomial. If no mask is provided, all the image pixels are considered for performing the interpolation.

See also

Function Syntax

This function returns the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
backgroundImage2d( std::shared_ptr< iolink::ImageView > inputImage,
                   std::shared_ptr< iolink::ImageView > inputMaskImage,
                   std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
background_image_2d( input_image, input_mask_image, output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
BackgroundImage2d( IOLink.ImageView inputImage,
                   IOLink.ImageView inputMaskImage,
                   IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name BackgroundImage2d

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Grayscale or Multispectral nullptr
input
inputMaskImage
The binary mask image for the polynomial interpolation. If it equals null, the background is computed from all pixels of the input image. This image must have same dimensions as the input image. Image Binary nullptr
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input. Image nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

BackgroundImage2d backgroundImage2dAlgo;
backgroundImage2dAlgo.setInputImage( polystyrene );
backgroundImage2dAlgo.setInputMaskImage( polystyrene_sep );
backgroundImage2dAlgo.execute();

std::cout << "outputImage:" << backgroundImage2dAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

background_image_2d_algo = imagedev.BackgroundImage2d()
background_image_2d_algo.input_image = polystyrene
background_image_2d_algo.input_mask_image = polystyrene_sep
background_image_2d_algo.execute()

print( "output_image:", str( background_image_2d_algo.output_image ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

BackgroundImage2d backgroundImage2dAlgo = new BackgroundImage2d
{
    inputImage = polystyrene,
    inputMaskImage = polystyrene_sep
};
backgroundImage2dAlgo.Execute();

Console.WriteLine( "outputImage:" + backgroundImage2dAlgo.outputImage.ToString() );

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );
auto polystyrene_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene_sep.vip" );

auto result = backgroundImage2d( polystyrene, polystyrene_sep );

std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))
polystyrene_sep = imagedev.read_vip_image(imagedev_data.get_image_path("polystyrene_sep.vip"))

result = imagedev.background_image_2d( polystyrene, polystyrene_sep )

print( "output_image:", str( result ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );
ImageView polystyrene_sep = Data.ReadVipImage( @"Data/images/polystyrene_sep.vip" );

IOLink.ImageView result = Processing.BackgroundImage2d( polystyrene, polystyrene_sep );

Console.WriteLine( "outputImage:" + result.ToString() );