ImageDev

AutocorrelationFilter

Computes the cross-correlation of an image by itself.

Access to parameter description

For an introduction: see section Image Correlation.

This algorithm consists in performing a convolution of an image with itself. In 2D, the autocorrelation value, for a pixel at $(n,m)$ coordinates, is given by: $$ O(n,m)=\sum_{i=1}^{N} \sum_{j=1}^{M} I(i,j)\times I(n+i-\frac{N}{2},m+j-\frac{M}{2}) $$ where $N$ is the image height and $M$ its width in pixels.
The output score is real-valued and normalized to have a maximum of 1.
The meanNormalization option activates a mode where the image average intensity is subtracted from the input intensities before computing autocorrelation scores. When this option is enabled, the minimum autocorrelation score is generally negative. Else, if the input image has an unsigned data type, the minimum autocorrelation score is positive.

Contrary to the CrossCorrelation2d algorithm, which is more dedicated to correlate a small pattern on a larger image, this algorithm processes all image pixels and does not set uncalculated values in the output image.

See also

Function Syntax

This function returns the outputImage output parameter.
// Function prototype.
std::shared_ptr< iolink::ImageView >
autocorrelationFilter( std::shared_ptr< iolink::ImageView > inputImage,
                       bool meanNormalization,
                       std::shared_ptr< iolink::ImageView > outputImage = NULL );
This function returns the outputImage output parameter.
// Function prototype.
autocorrelation_filter( input_image, mean_normalization = True, output_image = None )
This function returns the outputImage output parameter.
// Function prototype.
public static IOLink.ImageView
AutocorrelationFilter( IOLink.ImageView inputImage,
                       bool meanNormalization = true,
                       IOLink.ImageView outputImage = null );

Class Syntax

Parameters

Class Name AutocorrelationFilter

Parameter Name Description Type Supported Values Default Value
input
inputImage
The input image. Type of the image can be integer or float. Image Binary or Grayscale nullptr
input
meanNormalization
Option indicating whether the mean intensity of the input image is set to zero before performing the autocorrelation. Bool true
output
outputImage
The output image. Its dimensions are forced to the same values as the input. Type of the output image is forced to float. Its maximum is 1; its minimum can be negative. Image nullptr

Object Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

AutocorrelationFilter autocorrelationFilterAlgo;
autocorrelationFilterAlgo.setInputImage( polystyrene );
autocorrelationFilterAlgo.setMeanNormalization( true );
autocorrelationFilterAlgo.execute();

std::cout << "outputImage:" << autocorrelationFilterAlgo.outputImage()->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

autocorrelation_filter_algo = imagedev.AutocorrelationFilter()
autocorrelation_filter_algo.input_image = polystyrene
autocorrelation_filter_algo.mean_normalization = True
autocorrelation_filter_algo.execute()

print( "output_image:", str( autocorrelation_filter_algo.output_image ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

AutocorrelationFilter autocorrelationFilterAlgo = new AutocorrelationFilter
{
    inputImage = polystyrene,
    meanNormalization = true
};
autocorrelationFilterAlgo.Execute();

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

Function Examples

std::shared_ptr< iolink::ImageView > polystyrene = ioformat::readImage( std::string( IMAGEDEVDATA_IMAGES_FOLDER ) + "polystyrene.tif" );

auto result = autocorrelationFilter( polystyrene, true );

std::cout << "outputImage:" << result->toString();
polystyrene = ioformat.read_image(imagedev_data.get_image_path("polystyrene.tif"))

result = imagedev.autocorrelation_filter( polystyrene, True )

print( "output_image:", str( result ) );
ImageView polystyrene = ViewIO.ReadImage( @"Data/images/polystyrene.tif" );

IOLink.ImageView result = Processing.AutocorrelationFilter( polystyrene, true );

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