GetHistogramGray example for Delphi
{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}
var
nRet: Integer;
begin
ShowMessage ( 'Table size before call to GetHistogramGray: ' + IntToStr(LEADImage1.HistogramGrayTableSize)) ;
nRet:= LEADImage1.GetHistogramGray ( ) ;
if ( nRet = SUCCESS ) then
begin
LEADImage1.GetMinMaxVal ( ) ;
ShowMessage ('Highest Intensity: ' + IntToStr(LEADImage1.MaxVal) + ' Count: ' + IntToStr(LEADImage1.HistogramGrayTable[LEADImage1.MaxVal])
+ Chr(13) + 'Lowest Intensity: ' + IntToStr(LEADImage1.MinVal) + ' Count: ' + IntToStr(LEADImage1.HistogramGrayTable[LEADImage1.MinVal]));
end;
ShowMessage ( 'Table size of current histogram: ' + IntToStr(LEADImage1.HistogramGrayTableSize));
end;