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




Returns statistical information about the image. This command is available in the Raster Pro and above toolkits.

Syntax

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

Example

Visual BasicCopy Code
ImageProcessing.Effects.StatisticsInformationCommand
   Public Sub StatisticsInformationCommandExample()
      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 StatisticsInformationCommand = New StatisticsInformationCommand
      command.Channel = RasterColorChannel.Master
      command.Start = 0
      command.End = 255
      'Get statistical image information.
      command.Run(leadImage)
      MessageBox.Show("Minimum = " + command.Minimum.ToString + Chr(13) + _
         "Maximum = " + command.Maximum.ToString + Chr(13) + _
         "Mean = " + command.Mean.ToString + Chr(13) + _
         "Median = " + command.Median.ToString + Chr(13) + _
         "Percent = " + command.Percent.ToString + Chr(13) + _
         "PixelCount = " + command.PixelCount.ToString + Chr(13) + _
         "StandardDeviation = " + command.StandardDeviation.ToString + Chr(13) + _
         "TotalPixelCount = " + command.TotalPixelCount.ToString)

      RasterCodecs.Shutdown()
   End Sub
C#Copy Code
ImageProcessing.Effects.StatisticsInformationCommand 
      public void StatisticsInformationCommandExample() 
      { 
         // 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 
         StatisticsInformationCommand command = new StatisticsInformationCommand(); 
         command.Channel = RasterColorChannel.Master; 
         command.Start   = 0; 
         command.End    = 255; 
         //Get statistical image information. 
         command.Run(image); 
         MessageBox.Show("Minimum = " + command.Minimum + "\n" + 
            "Maximum = " + command.Maximum + "\n" + 
            "Mean = " + command.Mean + "\n" + 
            "Median = " + command.Median + "\n" + 
            "Percent = " + command.Percent + "\n" + 
            "PixelCount = " + command.PixelCount + "\n" + 
            "StandardDeviation = " + command.StandardDeviation + "\n" + 
            "TotalPixelCount = " + command.TotalPixelCount); 
 
         RasterCodecs.Shutdown(); 
      }

Remarks

  • This command calculates statistical information about the image.
  • The start and end values designate the range of colors that will be taken in consideration for producing the results. Only the values between Start and End are used for the calculation of the results. The range of each one depends on the bits per pixel of the image: in the case of 8 bits per component (RGB), the range is between 0 and 255; for 16 bits, the range is 0 through 65535; and for 12 bits, the range is 0 through 4095.
  • 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 signed data images.
  • This command does not support 32-bit grayscale images.

Inheritance Hierarchy

System.Object
   Leadtools.ImageProcessing.RasterCommand
      Leadtools.ImageProcessing.Effects.StatisticsInformationCommand

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