Ver Mensaje Individual
  #8  
Antiguo 31-10-2006
juanchi juanchi is offline
Miembro
 
Registrado: sep 2003
Posts: 56
Reputación: 21
juanchi Va por buen camino
El código!!!. Ahí va...

procedure TForm1.BitBtn1Click(Sender: TObject);
var
X, Y, Z, W, MaxValor,TamLinea: Integer;
Color : LongInt;
Histograma : array[0..255] of Integer;
begin


MaxValor := 0;
for Z:=0 to 255 do
begin
Histograma[Z] := 0;
end;

for Y := (image1.Width - image1.Width) to image1.Width do
begin
for X := (image1.Height - image1.Height) to image1.Height do
begin
Color := image1.Canvas.Pixels[X, Y]and $FF; {De RGB a 256 colores}
Histograma[Color] := Histograma[Color]+1;
end;
end;

for Z:=0 to 255 do
begin
if( Histograma[Z] > MaxValor ) then
MaxValor := Histograma[Z];
end;

for Z:=0 to 255 do
begin
TamLinea := ((Histograma[Z] * 312) div MaxValor);
image2.Canvas.MoveTo(18+Z, 326);
image2.Canvas.LineTo(18+Z, 326-TamLinea);
end;


end;


Salu2
Responder Con Cita