CorrelationList2 Example for Visual Basic

Dim RasterIO As New LEADRasterIO
Dim RasterProc As New LEADRasterProcess
Dim Raster1 As New LEADRaster
Dim Raster2 As New LEADRaster
Dim RasterList As New LEADRaster
Dim nNumOfPoints As Integer
Dim nRet As Integer
Dim x, y, i As Integer

RasterIO.Load Raster1, "c:\LetterA.cmp", 0, 0, 1
RasterIO.Load Raster2, "c:\LetterR.cmp", 0, 0, 1

RasterList.InsertBitmapListItem -1, Raster1.Bitmap
RasterList.InsertBitmapListItem -1, Raster2.Bitmap

RasterIO.Load LEADRasterView1.Raster, "c:\Clean.tif", 0, 0, 1

LEADRasterView1.RgnFrameType = RGNFRAME_ANIMATED

RasterProc.CorrelationListMaxPoints = 50
nRet = RasterProc.CorrelationList2(LEADRasterView1.Raster, 1, 1, 90, RasterList)

nNumOfPoints = RasterProc.CorrelationListCount

If (nRet = 0 And nNumOfPoints > 0) Then
   For i = 0 To nNumOfPoints - 1
      x = RasterProc.CorrelationListX(i)
      y = RasterProc.CorrelationListY(i)
      If (i = 0) Then
         LEADRasterView1.Raster.SetRgnRect x, y, Raster1.BitmapWidth, Raster1.BitmapHeight, L_RGN_SET
      Else
         LEADRasterView1.Raster.SetRgnRect x, y, Raster1.BitmapWidth, Raster1.BitmapHeight, L_RGN_OR
      End If
   Next i
End If