Initializes a new StatisticsInformationCommand with explicit parameters.
Syntax
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 Basic | Copy 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")
Dim command As StatisticsInformationCommand = New StatisticsInformationCommand(RasterColorChannel.Master, 0, 255)
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