GetHistogramGray example for Visual Basic
'This example gets a histogram for a 12-bit or 16-bit grayscale image and then
'displays the number of occurrences of the brightest and darkest intensities
Private Sub Command86_Click()
Dim nRet As Integer
Dim RasterProc As New LEADRasterProcess
MsgBox "Table size before call to GetHistogramGray: " & RasterProc.HistogramGrayTableSize
nRet = RasterProc.GetHistogramGray (LEADRasterView1.raster)
If nRet = 0 Then
LEADRasterView1.raster.GetMinMaxVal
MsgBox "Highest Intensity: 0x" & Hex(LEADRasterView1.raster.MaxVal) & " Count: " & RasterProc.HistogramGrayTable (LEADRasterView1.raster.MaxVal) _
& Chr(13) & "Lowest Intensity: 0x" & Hex(LEADRasterView1.raster.MinVal) & " Count: " & RasterProc.HistogramGrayTable(LEADRasterView1.raster.MinVal)
End If
MsgBox "Table size of current histogram: " & RasterProc.HistogramGrayTableSize
End Sub