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;
RasterProc: LEADRasterProcess;
begin
RasterProc:= CreateComObject (CLASS_LEADRasterProcess ) as LEADRasterProcess;
ShowMessage ('Table size before call to GetHistogramGray: ' + IntToStr(RasterProc.HistogramGrayTableSize));
nRet := RasterProc.GetHistogramGray (LEADRasterView1.Raster);
if (nRet= 0) then
begin
LEADRasterView1.Raster.GetMinMaxVal ();
ShowMessage ('Highest Intensity: 0x' + IntToHex(LEADRasterView1.Raster.MaxVal, 4) + ' Count: ' + IntToStr(RasterProc.HistogramGrayTable [LEADRasterView1.Raster.MaxVal])
+ Chr(13) + 'Lowest Intensity: 0x' + IntToHex(LEADRasterView1.Raster.MinVal, 4) + ' Count: ' + IntToStr(RasterProc.HistogramGrayTable[LEADRasterView1.Raster.MinVal]));
end;
ShowMessage ('Table size of current histogram: ' + IntToStr(RasterProc.HistogramGrayTableSize));
end;