ImageGear v26.5 - Updated
ImageGear.Core Assembly / ImageGear.Processing Namespace / ImGearRasterProcessing Class / TabulateHistogram Method
Page for which to tabulate histogram.
Two dimensional array that is filled with histogram data. It must be allocated prior to calling the method. First dimension corresponds to channel number, second dimension corresponds to histogram bin number.
Specifies image channels for which histogram shall be tabulated.
Example




In This Topic
    TabulateHistogram Method
    In This Topic
    Tabulates histograms for all image channels.
    Syntax
    'Declaration
     
    Public Shared Sub TabulateHistogram( _
       ByVal page As ImGearRasterPage, _
       ByVal histogram(,) As Integer, _
       ByVal channels As ImGearChannelRange _
    ) 
    'Usage
     
    Dim page As ImGearRasterPage
    Dim histogram() As Integer
    Dim channels As ImGearChannelRange
     
    ImGearRasterProcessing.TabulateHistogram(page, histogram, channels)
    public static void TabulateHistogram( 
       ImGearRasterPage page,
       int[,] histogram,
       ImGearChannelRange channels
    )
    public: static void TabulateHistogram( 
       ImGearRasterPage* page,
       int[,]* histogram,
       ImGearChannelRange channels
    ) 
    public:
    static void TabulateHistogram( 
       ImGearRasterPage^ page,
       array<int>^ histogram,
       ImGearChannelRange channels
    ) 

    Parameters

    page
    Page for which to tabulate histogram.
    histogram
    Two dimensional array that is filled with histogram data. It must be allocated prior to calling the method. First dimension corresponds to channel number, second dimension corresponds to histogram bin number.
    channels
    Specifies image channels for which histogram shall be tabulated.
    Remarks
    This method tabulates histograms for all image channels.

    This method supports images with channel depths ranging from 2 to 16.

    Example
    // Calculate image histogram.
    
    // Channel range to calculate.
    ImGearChannelRange igChannelRange = new ImGearChannelRange(0, igRasterPage.DIB.ChannelCount);
    // Integer array to hold histogram data
    int[,] histogramData = new int[igRasterPage.DIB.ChannelCount,(int)Math.Pow(2,igRasterPage.DIB.BitsPerChannel)];
    
    //Tabulate the histogram data.
    ImGearRasterProcessing.TabulateHistogram(igRasterPage, histogramData, igChannelRange);
    
    // Show a piece of the data.
    MessageBox.Show(histogramData[0,0] + " pixels had the value 0 for the first channel.", "Histogram Data");
    ' Calculate image histogram.
    
    ' Channel range to calculate.
    Dim igChannelRange As New ImGearChannelRange(0, igRasterPage.DIB.ChannelCount)
    ' Integer array to hold histogram data
    Dim numberOfValues As Integer
    numberOfValues = CInt(Math.Pow(2, igRasterPage.DIB.BitsPerChannel))
    Dim histogramData As Integer(,) = New Integer(igRasterPage.DIB.ChannelCount - 1, numberOfValues - 1) {}
    
    'Tabulate the histogram data.
    ImGearRasterProcessing.TabulateHistogram(igRasterPage, histogramData, igChannelRange)
    
    ' Show a piece of the data.
    MessageBox.Show(histogramData(0, 0).ToString() + " pixels had the value 0 for the first channel.", "Histogram Data")
    See Also