procedure Histograma( const BitmapOriginal: TBitmap );
var
x, y: Integer;
G: Byte;
W,H: Integer;
Histograma: Array [0..255] of byte;
begin
if BitmapOriginal.PixelFormat = pf24bit then
begin
W := BitmapOriginal.Width;
H := BitmapOriginal.Height;
for y := 0 to H-1 do
begin
ptrOrig := BitmapOriginal.ScanLine[y];
for x := 0 to W-1 do
begin
G := ( ptrOrig[3*x] + ptrOrig[3*x+1] + ptrOrig[3*x+2] ) div 3;
inc( Histograma[G] );
end;
end;
Chart1.SeriesList[0].Clear;
Chart1.SeriesList[0].AddArray( Histograma );
end;
end;
|