Initializes a new HistogramCommand class object with explicit parameters.
Syntax
Parameters
- channel
- Flags that indicate the channel for which
to get the histogram and the bits to use in calculating the histogram.
Example
Run the HistogramCommand on an image to get the red-channel histogram.
Visual Basic | Copy Code |
---|
Public Sub HistogramConstructorExample()
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 HistogramCommand = New HistogramCommand(HistogramCommandFlags.Red Or HistogramCommandFlags.AllBits)
command.Run(leadImage)
codecs.Save(leadImage, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24)
Dim histogramValues() As Integer = command.Histogram
RasterCodecs.Shutdown()
End Sub |
C# | Copy Code |
---|
public void HistogramConstructorExample() { // 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 HistogramCommand command = new HistogramCommand(HistogramCommandFlags.Red | HistogramCommandFlags.AllBits); command.Run(image); codecs.Save(image, LeadtoolsExamples.Common.ImagesPath.Path + "Result.jpg", RasterImageFormat.Jpeg, 24); //This is where the histogram information strored int [] histogramValues = command.Histogram; 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