Leadtools.ImageProcessing.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 15.12.10
CombineCommand Class
See Also  Members   Example 
Leadtools.ImageProcessing.Effects Namespace : CombineCommand Class




Combines image data from two images (source and destination), letting you specify the areas to be combined, the operations to be performed when combining the data, and which color planes (R or G or B or R, G, and B) are used.

Syntax

Visual Basic (Declaration) 
Public Class CombineCommand 
   Inherits RasterCommand
   Implements IRasterCommand 
Visual Basic (Usage)Copy Code
Dim instance As CombineCommand
C# 
public class CombineCommand : RasterCommand, IRasterCommand  
Managed Extensions for C++ 
public __gc class CombineCommand : public RasterCommand, IRasterCommand  
C++/CLI 
public ref class CombineCommand : public RasterCommand, IRasterCommand  

Example

Visual BasicCopy Code
ImageProcessing.Effects.CombineCommand
   Public Sub CombineCommandExample()
      RasterCodecs.Startup()
      Dim codecs As New RasterCodecs()
      codecs.ThrowExceptionsOnInvalidImages = True

      Dim leadImage As RasterImage = codecs.Load("C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg")

      ' Prepare the command
      Dim command As CombineCommand = New CombineCommand
      command.SourceImage = leadImage.Clone()
      command.DestinationRectangle = New System.Drawing.Rectangle(leadImage.Width \ 8, leadImage.Height \ 8, leadImage.Width, leadImage.Height)
      command.SourcePoint = New System.Drawing.Point(0, 0)
      command.Flags = CombineCommandFlags.OperationAdd Or CombineCommandFlags.Destination0 Or CombineCommandFlags.SourceRed Or CombineCommandFlags.DestinationGreen Or CombineCommandFlags.ResultBlue
      command.Run(leadImage)
      codecs.Save(leadImage, "C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Result.jpg", RasterImageFormat.Jpeg, 24)

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.Effects.CombineCommand 
      public void CombineCommandExample() 
      { 
         // Load an image 
         RasterCodecs.Startup(); 
         RasterCodecs codecs = new RasterCodecs(); 
         codecs.ThrowExceptionsOnInvalidImages = true; 
 
         RasterImage image = codecs.Load(@"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Master.jpg"); 
 
         // Prepare the command 
         CombineCommand command = new CombineCommand(); 
         command.SourceImage = image.Clone(); 
         command.DestinationRectangle = new Rectangle(image.Width / 8, image.Height / 8, image.Width, image.Height); 
         command.SourcePoint = new Point(0, 0); 
         command.Flags = CombineCommandFlags.OperationAdd | CombineCommandFlags.Destination0 | CombineCommandFlags.SourceRed | CombineCommandFlags.DestinationGreen | CombineCommandFlags.ResultBlue; 
         command.Run(image); 
         codecs.Save(image, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Result.jpg", RasterImageFormat.Jpeg, 24); 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

  • For example, suppose you use the SpatialFilterCommand to apply an edge detection filter. You can then use this command to combine the resulting image with the original one to produce an image with hard edges.
  • This method combines the data byte-by-byte. The two images can be any color resolution. Images that are 24-bits per pixel are the easiest and fastest to combine. This command uses Windows-style coordinates (with a top-left origin) to specify the areas to be combined.
  • If the channel setting for one of the images is the master channel (CombineCommandFlags.SourceMaster, CombineCommandFlags.DestinationMaster, or CombineCommandFlags.ResultMaster) the settings for all the images will be set to master.
  • If a region is defined for either the source or destination image, or both images, the combine applies only to the intersection of regions.
  • For example, assume CombineCommandFlags.SourceRed is passed for the source image, CombineCommandFlags.DestinationBlue is passed for the destination image and CombineCommandFlags.ResultGreen is passed for the resulting image. In this case, the green channel of the resulting image is calculated as the result of the operations applied to the red channel of the source image and the blue channel of the destination image. The other channels of the resulting image are unchanged.
  • This command 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 command does not support 32-bit grayscale images.
  • All images must be either signed or unsigned.
For more information, refer to Detecting and Enhancing Edges and Lines.
For more information, refer to Removing Noise.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Effects.CombineCommand

Requirements

Target Platforms: Microsoft .NET Framework 2.0, Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also