Wednesday, April 15, 2009

Histogram in Image Processing and Source Code In Delphi

Histogram is The Image Processing Basic That Shows How Much Pixel Value of Red Green And Blue in their Level (usually From 0 to 255) in a Image.


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…!!

0 comments:

Post a Comment

 
Design by Free WordPress Themes | Bloggerized by Lasantha - Premium Blogger Themes | Sweet Tomatoes Printable Coupons