ImageDev

ShadingCorrection

Corrects the lighting conditions of an image according to a black and a white reference.

Access to parameter description

This algorithm is bound for correcting the shading, that is to say the lighting standardisation. It is an histogram spreading performed pixelwise.
The process needs a white and a black reference for each pixel to apply the right correction.
The output image $O$ is computed from the input $I$ by applying the formula:
$$ O(i,j)=\left(\frac{I(i,j)-B(i,j)}{W(i,j)-B(i,j)}\right)\times F $$ Where: There are several ways to get a white reference: The black reference is generally omitted, which amounts to using the input image minimum intensity as a constant black reference. Otherwise, it can be generated in an analogous way to the white reference.

See also

Function Syntax

This function returns outputImage.
// Function prototype
std::shared_ptr< iolink::ImageView > shadingCorrection( std::shared_ptr< iolink::ImageView > inputImage, std::shared_ptr< iolink::ImageView > inputBlackReferenceImage, std::shared_ptr< iolink::ImageView > inputWhiteReferenceImage, double normalizationFactor, std::shared_ptr< iolink::ImageView > outputImage = nullptr );
This function returns outputImage.
// Function prototype.
shading_correction(input_image: idt.ImageType,
                   input_black_reference_image: idt.ImageType,
                   input_white_reference_image: idt.ImageType,
                   normalization_factor: float = 200,
                   output_image: idt.ImageType = None) -> idt.ImageType
This function returns outputImage.
// Function prototype.
public static IOLink.ImageView
ShadingCorrection( IOLink.ImageView inputImage,
                   IOLink.ImageView inputBlackReferenceImage,
                   IOLink.ImageView inputWhiteReferenceImage,
                   double normalizationFactor = 200,
                   IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image to correct. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputBlackReferenceImage
The input black reference image. If it equals null, the input image minimum is used as a constant value. This image must have same dimensions and type as the input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
inputWhiteReferenceImage
The input white reference image. If it equals null, the input image maximum is used as a constant value. This image must have same dimensions and type as the input image. Image Binary, Label, Grayscale or Multispectral nullptr
input
normalizationFactor
The normalization factor. Float64 Any value 200
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input. Image nullptr
Parameter Name Description Type Supported Values Default Value
input
input_image
The input image to correct. image Binary, Label, Grayscale or Multispectral None
input
input_black_reference_image
The input black reference image. If it equals null, the input image minimum is used as a constant value. This image must have same dimensions and type as the input image. image Binary, Label, Grayscale or Multispectral None
input
input_white_reference_image
The input white reference image. If it equals null, the input image maximum is used as a constant value. This image must have same dimensions and type as the input image. image Binary, Label, Grayscale or Multispectral None
input
normalization_factor
The normalization factor. float64 Any value 200
output
output_image
The output image. Its dimensions and type are forced to the same values as the input. image None
Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image to correct. Image Binary, Label, Grayscale or Multispectral null
input
inputBlackReferenceImage
The input black reference image. If it equals null, the input image minimum is used as a constant value. This image must have same dimensions and type as the input image. Image Binary, Label, Grayscale or Multispectral null
input
inputWhiteReferenceImage
The input white reference image. If it equals null, the input image maximum is used as a constant value. This image must have same dimensions and type as the input image. Image Binary, Label, Grayscale or Multispectral null
input
normalizationFactor
The normalization factor. Float64 Any value 200
output
outputImage
The output image. Its dimensions and type are forced to the same values as the input. Image null

Object Examples

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

ShadingCorrection shadingCorrectionAlgo;
shadingCorrectionAlgo.setInputImage( foam );
shadingCorrectionAlgo.setInputBlackReferenceImage( foam );
shadingCorrectionAlgo.setInputWhiteReferenceImage( foam );
shadingCorrectionAlgo.setNormalizationFactor( 200.0 );
shadingCorrectionAlgo.execute();

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

shading_correction_algo = imagedev.ShadingCorrection()
shading_correction_algo.input_image = foam
shading_correction_algo.input_black_reference_image = foam
shading_correction_algo.input_white_reference_image = foam
shading_correction_algo.normalization_factor = 200.0
shading_correction_algo.execute()

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

ShadingCorrection shadingCorrectionAlgo = new ShadingCorrection
{
    inputImage = foam,
    inputBlackReferenceImage = foam,
    inputWhiteReferenceImage = foam,
    normalizationFactor = 200.0
};
shadingCorrectionAlgo.Execute();

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

Function Examples

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

auto result = shadingCorrection( foam, foam, foam, 200.0 );

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

result = imagedev.shading_correction(foam, foam, foam, 200.0)

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

IOLink.ImageView result = Processing.ShadingCorrection( foam, foam, foam, 200.0 );

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