Processing math: 100%
ImageDev

MaskImage

Masks a graylevel or color image I by a binary mask B.

Access to parameter description

The output image O is given by the formula:
O(n,m)={I(n,m) if B(n,m)=10 if B(n,m)=0
Remarks: The same result can be obtained by See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > maskImage( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputBinaryImage, std::shared_ptr< iolink::ImageView > outputImage = NULL );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputBinaryImage
The binary mask image. This image must have same dimensions as the main input image. Image Binary nullptr
output
outputImage
The output image, size and type are forced to the same values as the input. Image nullptr

Object Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" );

MaskImage maskImageAlgo;
maskImageAlgo.setInputImage( foam );
maskImageAlgo.setInputBinaryImage( foam_sep );
maskImageAlgo.execute();

std::cout << "outputImage:" << maskImageAlgo.outputImage()->toString();

Function Examples

auto foam = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam.vip" );
auto foam_sep = readVipImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "foam_sep.vip" );

auto result = maskImage( foam, foam_sep );

std::cout << "outputImage:" << result->toString();