The SDL Component Suite is an industry leading collection of components supporting scientific and engineering computing. Please visit the SDL Web site for more information....



CalcImgCorrelation


Unit:SDL_math2
Class:none
Declaration:function CalcImgCorrelation (const Img1, Img2: TBitMap; Range1, Range2: TRect; CompareMode: TImgCompareMode): double;

The function CalcImgCorrelation calculates the correlation of two image areas. The correlation is based on the calculation of the correlation coefficient of all pixel values in the two areas. The images are referenced by the parameters Img1 and Img2. The areas to be compared are specified by the rectangles Range1 and Range2, which have to be of equal size. In the case of unequal rectangles, an exception is generated. The parameter CompareMode determines how the correlation coefficient is calculated (see TImgCompareMode for details).

Hint: In applications where the black and white components of an image are important (e.g. when correlating geographic maps) either individual colors (icmRed, icmBlue, icmGreen), or the lightness (icmLightness) of the pixels should be used. Hue and saturation (icmHue and icmSaturation) deliver less than satisfactory results if the image is stored as a JPG file (due to the lossy compression algorithm).

Remark: Please note that the calculation of hue, saturation and lightness require considerable extra time. So for a quick comparison, you should use the individual colors or the gray values.



Last Update: 2023-Feb-06