ImageDev

MatchContrast

Computes a new image considering the dynamic range of a reference one.

Access to parameter description

This algorithm fits the dynamic range of an input image on a reference one.
The aim of this algorithm is to get an homogeneous dynamic range when processing many images, in order to be able to easily apply the same process on all of them if the intensity information is required.

<b> (a) </b>
(a)
<b> (b) </b>
(b)
<b> (c) </b>
(c)
Figure 1. The Match contrast algorithm applied on similar images with different dynamic ranges:
(a) the model image to dynamically register, (b) the reference image, (c) the model image with same dynamic as the reference


There are two ways for computing the resulting image: either from the information of the reference image mean and variance, or from its histogram.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > matchContrast( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputReferenceImage, MatchContrast::MatchingMode matchingMode, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
match_contrast(input_image: idt.ImageType,
               input_reference_image: idt.ImageType,
               matching_mode: MatchContrast.MatchingMode = MatchContrast.MatchingMode.MEAN_VARIANCE,
               output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
MatchContrast( IOLink.ImageView inputImage,
               IOLink.ImageView inputReferenceImage,
               MatchContrast.MatchingMode matchingMode = ImageDev.MatchContrast.MatchingMode.MEAN_VARIANCE,
               IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The model input image (the image to dynamically register). Image Grayscale or Multispectral nullptr
input
inputReferenceImage
The reference image. Its type must be the same as the model. Its dimensions can be different. Image Binary, Label, Grayscale or Multispectral nullptr
input
matchingMode
The matching mode.
MEAN_VARIANCE The computation is based on the intensity mean and variance values of the image.
HISTOGRAM The computation is based on the histogram of the image.
Enumeration MEAN_VARIANCE
output
outputImage
The output image. Its dimensions and type are forced to the same values as the model input. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The model input image (the image to dynamically register). image Grayscale or Multispectral None
input
input_reference_image
The reference image. Its type must be the same as the model. Its dimensions can be different. image Binary, Label, Grayscale or Multispectral None
input
matching_mode
The matching mode.
MEAN_VARIANCE The computation is based on the intensity mean and variance values of the image.
HISTOGRAM The computation is based on the histogram of the image.
enumeration MEAN_VARIANCE
output
output_image
The output image. Its dimensions and type are forced to the same values as the model input. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The model input image (the image to dynamically register). Image Grayscale or Multispectral null
input
inputReferenceImage
The reference image. Its type must be the same as the model. Its dimensions can be different. Image Binary, Label, Grayscale or Multispectral null
input
matchingMode
The matching mode.
MEAN_VARIANCE The computation is based on the intensity mean and variance values of the image.
HISTOGRAM The computation is based on the histogram of the image.
Enumeration MEAN_VARIANCE
output
outputImage
The output image. Its dimensions and type are forced to the same values as the model input. Image null

Object Examples

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

MatchContrast matchContrastAlgo;
matchContrastAlgo.setInputImage( foam );
matchContrastAlgo.setInputReferenceImage( foam );
matchContrastAlgo.setMatchingMode( MatchContrast::MatchingMode::MEAN_VARIANCE );
matchContrastAlgo.execute();

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

match_contrast_algo = imagedev.MatchContrast()
match_contrast_algo.input_image = foam
match_contrast_algo.input_reference_image = foam
match_contrast_algo.matching_mode = imagedev.MatchContrast.MEAN_VARIANCE
match_contrast_algo.execute()

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

MatchContrast matchContrastAlgo = new MatchContrast
{
    inputImage = foam,
    inputReferenceImage = foam,
    matchingMode = MatchContrast.MatchingMode.MEAN_VARIANCE
};
matchContrastAlgo.Execute();

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

Function Examples

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

auto result = matchContrast( foam, foam, MatchContrast::MatchingMode::MEAN_VARIANCE );

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

result = imagedev.match_contrast(foam, foam, imagedev.MatchContrast.MEAN_VARIANCE)

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

IOLink.ImageView result = Processing.MatchContrast( foam, foam, MatchContrast.MatchingMode.MEAN_VARIANCE );

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