Leadtools.ImageProcessing.Color Send comments on this topic. | Back to Introduction - All Topics | Help Version 16.5.9.25
HistogramCommand Constructor(HistogramCommandFlags)
See Also  Example



channel
Flags that indicate the channel for which to get the histogram and the bits to use in calculating the histogram.
Initializes a new HistogramCommand class object with explicit parameters.

Syntax

Visual Basic (Declaration) 
Public Function New( _
   ByVal channel As HistogramCommandFlags _
)
Visual Basic (Usage)Copy Code
Dim channel As HistogramCommandFlags
 
Dim instance As HistogramCommand(channel)
C# 
public HistogramCommand( 
   HistogramCommandFlags channel
)
C++/CLI 
public:
HistogramCommand( 
   HistogramCommandFlags channel
)

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 BasicCopy 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")

   ' Prepare the command
   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)
   'This is where the histogram information strored
   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