Below is Source Code for Histogram Image in Delphi.
procedure TFormHistogram.Histogram;
var i,j :integer;
temp:PByteArray;
begin
for i:=0 to 255 do
begin
R[i]:=0;
G[i]:=0;
B[i]:=0;
end;
for i:=0 to FormHasil.ImgHasil.Picture.Bitmap.Height-1 do
begin
temp:=FormHasil.ImgHasil.Picture.Bitmap.ScanLine[i];
for j:= 0 to FormHasil.ImgHasil.Picture.Bitmap.Width-1 do
begin
inc(B[temp[3*j]]);
inc(G[temp[3*j+1]]);
inc(R[temp[3*j+2]]);
end;
end;
FormHistogram.ChartR.Series[0].Clear;
FormHistogram.ChartG.Series[0].Clear;
FormHistogram.ChartB.Series[0].Clear;
for i:=0 to 255 do
begin
FormHistogram.ChartR.Series[0].AddXY(i, R[i]);
FormHistogram.ChartG.Series[0].AddXY(i, G[i]);
FormHistogram.ChartB.Series[0].AddXY(i, B[i]);
end;
end;
Please Comment If I’m Wrong. Comment are widely open…!!
Tidak ada komentar:
Posting Komentar