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




Applies various 3d effects to an image. This command is available in the Raster Pro and above toolkits.

Syntax

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

Example

Visual BasicCopy Code
ImageProcessing.Effects.MaskConvolutionCommand
   Public Sub MaskConvolutionCommandExample()
      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 New MaskConvolutionCommand

      ' Apply 3D emboss effect on the image, with 0 degrees as the angle of apparent light,
      ' depth of 1.50, and height of 3
      command.Angle = 0
      command.Depth = 150
      command.Height = 3
      command.Type = MaskConvolutionCommandType.Emboss
      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.MaskConvolutionCommand 
      public void MaskConvolutionCommandExample() 
      { 
         // 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 
         MaskConvolutionCommand command = new MaskConvolutionCommand(); 
 
         // Apply 3D emboss effect on the image, with 0 degrees as the angle of apparent light, 
         // depth of 1.50, and height of 3 
         command.Angle = 0; 
         command.Depth = 150; 
         command.Height = 3; 
         command.Type = MaskConvolutionCommandType.Emboss; 
         command.Run(image); 
         codecs.Save(image, @"C:\Program Files\LEAD Technologies\LEADTOOLS 15\Images\Result.jpg", RasterImageFormat.Jpeg, 24); 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

  • For EdgeDetection, the results are the same for opposite angles. For example, angles 0 and 180 have the same result when used with the edge detection mask.
  • When an image undergoes image convolution each pixel of the image is multiplied by a mask to create a new pixel value. The mask is an array of values that describes the weight that should be given to each of the pixels surrounding a specific pixel. The new pixel value is the result of the mask sum being divided by the mask weight. Using different masks result in different alterations of the image. The masks used in this command result in different types of edge detection.
  • As an example of the different masks, consider the following example:
  • To obtain these images, the following settings were used:
    ParametersEmbossEdgeESplotchSplotch
    Angle001800
    Depth3333
    Height250250100100

  • 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.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Effects.MaskConvolutionCommand

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