LBitmap::Correlation

#include "ltwrappr.h"

virtual L_INT LBitmap::Correlation (phCorBitmap, pPoints, uMaxPoints, puNumOfPoints, uXStep, uYStep, uThreshold)

virtual L_INT LBitmap::Correlation (plCorBitmap, pPoints, uMaxPoints, puNumOfPoints, uXStep, uYStep, uThreshold)

pBITMAPHANDLE phCorBitmap;

/* pointer to the correlation bitmap handle */

LBitmapBase plCorBitmap;

/* pointer to the correlation bitmap object */

POINT L_FAR * pPoints;

/* pointer to an array of points */

L_UINT uMaxPoints;

/* array size */

L_UINT L_FAR * puNumOfPoints;

/* pointer to the array size */

L_UINT uXStep;

/* size of the X step */

L_UINT uYStep;

/* size of the Y step */

L_UINT uThreshold;

/* threshold */

This function compares pCorBitmap (or part of pCorBitmap) with all the areas of the same dimensions in pBitmap and finds those portions that match according to the measure of correlation. This function is available in the Document/Medical Toolkits.

Parameter

Description

phCorBitmap

Pointer to the bitmap handle that references the bitmap for which to search.

plCorBitmap

Pointer to the bitmap object that references the bitmap for which to search.

pPoints

Pointer to an array of points. This array will be filled with the starting points for the correlated areas.

uMaxPoints

Size of the point array. This is also equal to the maximum number of regions in pBitmap that can be found to be correlated.

puNumOfPoints

Pointer to a variable to be updated with the number of areas in pBitmap actually found to be correlated to pCorBitmap. Its maximum value is uMaxPoints.

uXStep

Step size in the X direction (along image width), in pixels. For best results, use 1.

uYStep

Step size in the Y direction (along image height) ), in pixels. For best results, use 1.

uThreshold

Value that indicates the correlation threshold, which is a measure of association required to consider two areas to be correlated. If the correlation value between pCorBitmap and an area in pBitmap is less than the correlation threshold they are uncorrelated. Valid values range from 0 (zero resemblance) to 100 (perfect resemblance).

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This function compares phCorBitmap (or a part of phCorBitmap) with all the areas of the same dimensions in Bitmap object and finds those areas that match according to the measure of correlation. Correlation is a measure of association (resemblance) between two images. It varies from 0 (zero resemblance) to 100 (perfect resemblance). This function updates the pPoints parameter with the point of origin for those areas of Bitmap object where the resemblance with phCorBitmap (or part of phCorBitmap) is greater than the value of uThreshold. The pCorBitmap dimensions must be less than or equal to the Bitmap object dimensions.

For example:

Select a bitmap of the object for which you want to look. Put it in phCorBitmap

For example:

image\Correlation1.gif

Select a bitmap that contains the object for which you are searching and put it in Bitmap object.

For example:

image\Correlation2.gif

Call LBitmap::Correlation from your bitmap object.

The function will update the pPoints array parameter with the point of origin (top-left) for each area of the bitmap pBitmap where the correlation with phCorBitmap is greater than the correlation threshold. The height and width of the rectangles are the same as for phCorBitmap.

The result is:

image\Correlation3.gif

This function supports 12 and 16-bit grayscale and 48 and 64-bit color images. Support for 12 and 16-bit grayscale and 48 and 64-bit color images is available only in the Document/Medical toolkits.

This function does not support signed data images. It returns the error code ERROR_SIGNED_DATA_NOT_SUPPORTED if a signed data image is passed to this function.

Required DLLs and Libraries

LTIMG

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

See Also

Functions:

LBitmap::IntensityDetect, LBitmap::SpatialFilter, LBitmap::BinaryFilter, LBitmap::MaxFilter, LBitmap::MinFilter.

Topics:

Processing an Image

 

Raster Image Functions: Comparing Images

 

Color Halftones and Halftone Images

 

Raster Image Functions: Processing an Image

Example

void MyTestFunction(LAnimationWindow * LAniWnd) 
{
   LBitmap CorBitmap; 
   POINT pPoints[10] = {0};
   L_UINT uNumOfPoints; 
   /* Load the bitmap, keeping the bits per pixel of the file */
   CorBitmap.Load(TEXT("c:\\T.BMP"));
   
   /*Apply the correlation filter*/
   LAniWnd->Correlation(&CorBitmap, pPoints, 90 , &uNumOfPoints, 1, 2, 10); 
   CorBitmap.Free();
}