LEADTOOLS Image Processing (Leadtools.ImageProcessing.Core assembly)

CorrelationListCommand Class

Show in webframe
Example 







Members 
Compares the images in a list with all the areas of the same dimensions in an image and finds those portions that match according to the measure of correlation. This method is only available in the Document/Medical toolkits.
Object Model
Syntax
'Declaration
 
Public Class CorrelationListCommand 
   Inherits Leadtools.ImageProcessing.RasterCommand
   Implements Leadtools.ImageProcessing.IRasterCommand 
'Usage
 
Dim instance As CorrelationListCommand
public sealed class CorrelationListCommand : Leadtools.ImageProcessing.IRasterCommand  
@interface LTCorrelationListCommand : LTRasterCommand
public class CorrelationListCommand extends RasterCommand
function Leadtools.ImageProcessing.Core.CorrelationListCommand()
public ref class CorrelationListCommand : public Leadtools.ImageProcessing.RasterCommand, Leadtools.ImageProcessing.IRasterCommand  
Remarks

In Silverlight and Windows Phone versions of LEADTOOLS, this image processing command will fail if the image data for the RasterImage object is stored internally using a Silverlight WriteableBitmap object. For more information, refer to Image Processing Command Limitations in Silverlight.

Example
Copy Code  
Imports Leadtools
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing
Imports Leadtools.ImageProcessing.Core

Public Sub CorrelationListCommandExample()
   ' Load an image
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim image As RasterImage = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"))

   Dim command As CorrelationListCommand = New CorrelationListCommand()
   Dim copyRectangle As CopyRectangleCommand = New CopyRectangleCommand()

   Dim rc_cor As LeadRect = New LeadRect(327, 378, 22, 28)
   copyRectangle.Rectangle = rc_cor
   copyRectangle.Run(image)
   command.CorrelationImage = copyRectangle.DestinationImage.Clone()

   rc_cor = New LeadRect(283, 378, 22, 28)
   copyRectangle.Rectangle = rc_cor
   copyRectangle.Run(image)
   command.CorrelationImage.AddPage(copyRectangle.DestinationImage.Clone())

   Dim points(30) As LeadPoint
   Dim listIndex(30) As Integer

   command.Points = points
   command.ListIndex = listIndex
   command.Threshold = 90
   command.XStep = 1
   command.YStep = 1
   command.Run(image)

End Sub

Public NotInheritable Class LEAD_VARS
Public Const ImagesDir As String = "C:\Users\Public\Documents\LEADTOOLS Images"
End Class
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing;
using Leadtools.ImageProcessing.Core;

public void CorrelationListCommandExample()
{
   // Load an image
   RasterCodecs codecs = new RasterCodecs();
   codecs.ThrowExceptionsOnInvalidImages = true;

   RasterImage image = codecs.Load(Path.Combine(LEAD_VARS.ImagesDir, "Master.jpg"));

   CorrelationListCommand command = new CorrelationListCommand();
   CopyRectangleCommand copyRectangle = new CopyRectangleCommand();

   LeadRect rc_cor = new LeadRect(327, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   command.CorrelationImage = copyRectangle.DestinationImage.Clone();

   rc_cor = new LeadRect(283, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   command.CorrelationImage.AddPage(copyRectangle.DestinationImage.Clone());

   command.Points = new LeadPoint[30];
   command.ListIndex = new int[30];
   command.Threshold = 90;
   command.XStep = 1;
   command.YStep = 1;
   command.Run(image);

}

static class LEAD_VARS
{
public const string ImagesDir = @"C:\Users\Public\Documents\LEADTOOLS Images";
}
function CorrelationListCommandExample()
{
   var codecs = new Leadtools.Codecs.RasterCodecs();
   codecs.throwExceptionsOnInvalidImages = true;

   // Load the image
   var srcFileName = "Assets\\Image1.cmp";
   return Tools.AppInstallFolder().getFileAsync(srcFileName).then(function (loadFile) {
      return codecs.loadAsync(Leadtools.LeadStreamFactory.create(loadFile));
   }).then(function (image) {
      // Prepare the command
      with (Leadtools.ImageProcessing.Core) {
         var command = new CorrelationListCommand();
         var copyRectangle = new Leadtools.ImageProcessing.CopyRectangleCommand();

         var rc_cor = Leadtools.LeadRectHelper.create(327, 378, 22, 28);
         copyRectangle.rectangle = rc_cor;
         copyRectangle.run(image);
         command.correlationImage = copyRectangle.destinationImage.clone();

         rc_cor = Leadtools.LeadRectHelper.create(283, 378, 22, 28);
         copyRectangle.rectangle = rc_cor;
         copyRectangle.run(image);
         command.correlationImage.addPage(copyRectangle.destinationImage.clone());

         command.points = new Array();
         //Size the array to 30
         for (var i = 0; i < 30; i++)
            command.points[i] = Leadtools.LeadPointHelper.create(0, 0);

         command.listIndex = new Array();
         //Size the array to 30
         for (var i = 0; i < 30; i++)
            command.listIndex[i] = 0;

         command.threshold = 90;
         command.xStep = 1;
         command.yStep = 1;
         command.run(image);
      }
   });
}
using Leadtools;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Core;
using Leadtools.ImageProcessing;

      
public async Task CorrelationListCommandExample()
{
   // Load an image
   RasterCodecs codecs = new RasterCodecs();
   codecs.ThrowExceptionsOnInvalidImages = true;
   // Load the image
   string srcFileName = @"Assets\Image1.cmp";
   StorageFile loadFile = await Tools.AppInstallFolder.GetFileAsync(srcFileName);
   RasterImage image = await codecs.LoadAsync(LeadStreamFactory.Create(loadFile));

   CorrelationListCommand command = new CorrelationListCommand();
   CopyRectangleCommand copyRectangle = new CopyRectangleCommand();

   LeadRect rc_cor = LeadRectHelper.Create(327, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   command.CorrelationImage = copyRectangle.DestinationImage.Clone();

   rc_cor = LeadRectHelper.Create(283, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   command.CorrelationImage.AddPage(copyRectangle.DestinationImage.Clone());

   command.Points = new LeadPoint[30];
   command.ListIndex = new int[30];
   command.Threshold = 90;
   command.XStep = 1;
   command.YStep = 1;
   command.Run(image);

}
using Leadtools;
using Leadtools.ImageProcessing;
using Leadtools.Examples;
using Leadtools.Codecs;
using Leadtools.ImageProcessing.Core;

public void CorrelationListCommandExample(RasterImage image, Stream outStream)
{
   CorrelationListCommand command = new CorrelationListCommand();
   CopyRectangleCommand copyRectangle = new CopyRectangleCommand();
   LeadRect rc_cor = new LeadRect(327, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   command.CorrelationImage = copyRectangle.DestinationImage.Clone();

   rc_cor = new LeadRect(283, 378, 22, 28);
   copyRectangle.Rectangle = rc_cor;
   copyRectangle.Run(image);
   command.CorrelationImage.AddPage(copyRectangle.DestinationImage.Clone());

   command.Points = new LeadPoint[30];
   command.ListIndex = new int[30];
   command.Threshold = 90;
   command.XStep = 1;
   command.YStep = 1;
   command.Run(image);

   // Save result image
   RasterCodecs codecs = new RasterCodecs();
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24);
   image.Dispose();
}
Imports Leadtools
Imports Leadtools.ImageProcessing
Imports Leadtools.Codecs
Imports Leadtools.ImageProcessing.Core

Public Sub CorrelationListCommandExample(ByVal image As RasterImage, ByVal outStream As Stream)
   Dim command As CorrelationListCommand = New CorrelationListCommand()
   Dim copyRectangle As CopyRectangleCommand = New CopyRectangleCommand()
   Dim rc_cor As LeadRect = New LeadRect(327, 378, 22, 28)
   copyRectangle.Rectangle = rc_cor
   copyRectangle.Run(image)
   command.CorrelationImage = copyRectangle.DestinationImage.Clone()

   rc_cor = New LeadRect(283, 378, 22, 28)
   copyRectangle.Rectangle = rc_cor
   copyRectangle.Run(image)
   command.CorrelationImage.AddPage(copyRectangle.DestinationImage.Clone())

   command.Points = New LeadPoint(29){}
   command.ListIndex = New Integer(29){}
   command.Threshold = 90
   command.XStep = 1
   command.YStep = 1
   command.Run(image)

   ' Save result image
   Dim codecs As RasterCodecs = New RasterCodecs()
   codecs.Save(image, outStream, RasterImageFormat.Jpeg, 24)
   image.Dispose()
End Sub
Requirements

Target Platforms

See Also

Reference

CorrelationListCommand Members
Leadtools.ImageProcessing.Core Namespace
Leadtools.ImageProcessing.Color.IntensityDetectCommand
Leadtools.ImageProcessing.Effects.SpatialFilterCommand
Leadtools.ImageProcessing.Effects.BinaryFilterCommand
MaximumCommand Class
MinimumCommand Class
CorrelationCommand Class

 

 


Products | Support | Contact Us | Copyright Notices
© 2006-2014 All Rights Reserved. LEAD Technologies, Inc.