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:
See also
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:
- $B$ is the black reference image,
- $W$ is the white reference image,
- $F$ is a normalization factor. If each pixel of the input image is lower than its counterpart in the white reference, it can be its minimum intensity. Else, it must be lower than the maximum to avoid overflows. A value of 200 usually works well with unsigned 8-bit images.
- At the acquisition, by grabbing an image of a void field (white paper in photography, slice without sample in light microscopy by transmission, defocused bright sample in light microscopy by reflexion).
- With image processing; for example, by applying a Morphological Closing or a Background estimation.
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 = NULL );
This function returns outputImage.
// Function prototype. shading_correction( input_image, input_black_reference_image, input_white_reference_image, normalization_factor = 200, output_image = None )
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 | |
---|---|---|---|---|---|
![]() |
inputImage |
The input image to correct. | Image | Binary, Label, Grayscale or Multispectral | nullptr |
![]() |
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 |
![]() |
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 |
![]() |
normalizationFactor |
The normalization factor. | Float64 | Any value | 200 |
![]() |
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_image |
The input image to correct. | image | Binary, Label, Grayscale or Multispectral | None |
![]() |
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_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 |
![]() |
normalization_factor |
The normalization factor. | float64 | Any value | 200 |
![]() |
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 | |
---|---|---|---|---|---|
![]() |
inputImage |
The input image to correct. | Image | Binary, Label, Grayscale or Multispectral | null |
![]() |
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 |
![]() |
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 |
![]() |
normalizationFactor |
The normalization factor. | Float64 | Any value | 200 |
![]() |
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() );