Leadtools.ImageProcessing.Effects Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
StatisticsInformationCommand Constructor(RasterColorChannel,Int32,Int32)
See Also  Example
Leadtools.ImageProcessing.Effects Namespace > StatisticsInformationCommand Class > StatisticsInformationCommand Constructor : StatisticsInformationCommand Constructor(RasterColorChannel,Int32,Int32)



channel
The channel for which to get the information. This value is ignored if the image is 12 or 16-bit grayscale.
start
Indicates the beginning color value of the range for the evaluation. This property only accepts positive values.
end
Indicates the ending color value of the range for the evaluation. This property only accepts positive values.
Initializes a new StatisticsInformationCommand with explicit parameters.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal channel As RasterColorChannel, _
   ByVal start As Integer, _
   ByVal end As Integer _
)
Visual Basic (Usage)Copy Code
Dim channel As RasterColorChannel
Dim start As Integer
Dim end As Integer
 
Dim instance As StatisticsInformationCommand(channel, start, end)
C# 
public StatisticsInformationCommand( 
   RasterColorChannel channel,
   int start,
   int end
)
C++/CLI 
public:
StatisticsInformationCommand( 
   RasterColorChannel channel,
   int start,
   int end
)

Parameters

channel
The channel for which to get the information. This value is ignored if the image is 12 or 16-bit grayscale.
start
Indicates the beginning color value of the range for the evaluation. This property only accepts positive values.
end
Indicates the ending color value of the range for the evaluation. This property only accepts positive values.

Example

Run the StatisticsInformationCommand on an image.

Visual BasicCopy Code
Public Sub StatisticsInformationConstructorExample()
   RasterCodecs.Startup()
   Dim codecs As New RasterCodecs()
   codecs.ThrowExceptionsOnInvalidImages = True

   Dim leadImage As RasterImage = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg")

   ' Prepare the command
   Dim command As StatisticsInformationCommand = New StatisticsInformationCommand(RasterColorChannel.Master, 0, 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
public void StatisticsInformationConstructorExample() 

   // Load an image 
   RasterCodecs.Startup(); 
   RasterCodecs codecs = new RasterCodecs(); 
   codecs.ThrowExceptionsOnInvalidImages = true; 
 
   RasterImage image = codecs.Load(LeadtoolsExamples.Common.ImagesPath.Path + "Master.jpg"); 
 
   // Prepare the command 
   StatisticsInformationCommand command = new StatisticsInformationCommand(RasterColorChannel.Master, 0, 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(); 
}

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