ImageDev

CombineByMask

Produces a combination of two images in a complementary way.

Access to parameter description

CombineByMask produces an output image $O$ which is the combination of two images $I_1$ and $I_2$ by following a binary mask B as follows:
$$ O(n,m)=\left\{\begin{array}{ll} I_1(n,m) & ~\mbox{if $B(n,m) = 1$}\\ I_2(n,m) & ~\mbox{if $B(n,m) = 0$}\end{array}\right. $$ See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > combineByMask( std::shared_ptr< iolink::ImageView > inputImage1, std::shared_ptr< iolink::ImageView > inputImage2, std::shared_ptr< iolink::ImageView > inputBinaryImage, std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns outputImage.
// Function prototype.
combine_by_mask( input_image1,
                 input_image2,
                 input_binary_image,
                 output_image = None )
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
CombineByMask( IOLink.ImageView inputImage1,
               IOLink.ImageView inputImage2,
               IOLink.ImageView inputBinaryImage,
               IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage1
The first input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputImage2
The second input image. It must have same dimensions and type as other input images. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputBinaryImage
The input binary mask. It must have same dimensions and type as other input images. Image Binary nullptr
output
outputImage
The output image. Its dimensions and type are forced to the same values as the inputs. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image1
The first input image. image Binary, Label, Grayscale or Multispectral None
input
input_image2
The second input image. It must have same dimensions and type as other input images. image Binary, Label, Grayscale or Multispectral None
input
input_binary_image
The input binary mask. It must have same dimensions and type as other input images. image Binary None
output
output_image
The output image. Its dimensions and type are forced to the same values as the inputs. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage1
The first input image. Image Binary, Label, Grayscale or Multispectral null
input
inputImage2
The second input image. It must have same dimensions and type as other input images. Image Binary, Label, Grayscale or Multispectral null
input
inputBinaryImage
The input binary mask. It must have same dimensions and type as other input images. Image Binary null
output
outputImage
The output image. Its dimensions and type are forced to the same values as the inputs. Image null

Object Examples

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

CombineByMask combineByMaskAlgo;
combineByMaskAlgo.setInputImage1( foam );
combineByMaskAlgo.setInputImage2( foam );
combineByMaskAlgo.setInputBinaryImage( foam_sep );
combineByMaskAlgo.execute();

std::cout << "outputImage:" << combineByMaskAlgo.outputImage()->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip"))

combine_by_mask_algo = imagedev.CombineByMask()
combine_by_mask_algo.input_image1 = foam
combine_by_mask_algo.input_image2 = foam
combine_by_mask_algo.input_binary_image = foam_sep
combine_by_mask_algo.execute()

print( "output_image:", str( combine_by_mask_algo.output_image ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

CombineByMask combineByMaskAlgo = new CombineByMask
{
    inputImage1 = foam,
    inputImage2 = foam,
    inputBinaryImage = foam_sep
};
combineByMaskAlgo.Execute();

Console.WriteLine( "outputImage:" + combineByMaskAlgo.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 = combineByMask( foam, foam, foam_sep );

std::cout << "outputImage:" << result->toString();
foam = imagedev.read_vip_image(imagedev_data.get_image_path("foam.vip"))
foam_sep = imagedev.read_vip_image(imagedev_data.get_image_path("foam_sep.vip"))

result = imagedev.combine_by_mask( foam, foam, foam_sep )

print( "output_image:", str( result ) )
ImageView foam = Data.ReadVipImage( @"Data/images/foam.vip" );
ImageView foam_sep = Data.ReadVipImage( @"Data/images/foam_sep.vip" );

IOLink.ImageView result = Processing.CombineByMask( foam, foam, foam_sep );

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