ClearImage .NET API
MeasureHorzHistogram Method (CiTools)
Example 





Inlite.ClearImage Namespace > CiTools Class : MeasureHorzHistogram Method
Measure horizontal histogram
Syntax
'Declaration
 
Public Function MeasureHorzHistogram() As System.Integer()
'Usage
 
Dim instance As CiTools
Dim value() As System.Integer
 
value = instance.MeasureHorzHistogram()
public System.int[] MeasureHorzHistogram()
public function MeasureHorzHistogram(): System.array of Integer; 
public function MeasureHorzHistogram() : System.int[];
public:
System.array<int>^ MeasureHorzHistogram(); 

Return Value

An array of integers with the number of pixels in each column.
Remarks
Method requires bi-tonal image (object.Image.BitsPerPixel = 1).
Example
void MeasureHistogram(string imageFile)
{
    //  Open image file
    CiServer ci = Inlite.ClearImageNet.Server.GetThreadServer();
    CiTools Tools = ci.CreateTools();
    Tools.Image.Open(imageFile, 1);
    //  Do processing
    int[] Hist; int i; int start;
    Hist = Tools.MeasureHorzHistogram();
    start = 0; if (Tools.Image.IsZone) { start = Tools.Image.Zone.top; }
    for (i = 0; i < Hist.Length; i++)
    { Console.WriteLine("Row=" + (start + i) + " Pixels=" + Hist[i]); }

    Hist = Tools.MeasureVertHistogram();
    start = 0; if (Tools.Image.IsZone) { start = Tools.Image.Zone.top; }
    for (i = 0; i < Hist.Length; i++)
    { Console.WriteLine("Col=" + (start + i) + " Pixels=" + Hist[i]); }
}
Sub MeasureHistogram(imageFile As String)
    ' Open image file
    Dim ci As CiServer = Inlite.ClearImageNet.Server.GetThreadServer()
    Dim Tools As CiTools = ci.CreateTools()
    Tools.Image.Open(imageFile, 1)
    ' Do processing
    Dim Hist As Integer(), i As Integer, start As Integer
    Hist = Tools.MeasureHorzHistogram()
    start = 0 : If (Tools.Image.IsZone) Then start = Tools.Image.Zone.top
    For i = 0 To Hist.Length - 1
        Console.WriteLine("Row=" + start + i + " Pixels=" + Hist(i))
    Next

    Hist = Tools.MeasureVertHistogram()
    start = 0 : If (Tools.Image.IsZone) Then start = Tools.Image.Zone.left
    For i = 0 To Hist.Length - 1
        Console.WriteLine("Col=" + start + i + " Pixels=" + Hist(i))
    Next
End Sub
See Also

Reference

CiTools Class
CiTools Members
MeasureHorzHistogram Method
MeasureVertHistogram Method