Einzelnen Beitrag anzeigen

Landfloh

Registriert seit: 17. Feb 2008
75 Beiträge
 
Delphi 7 Personal
 
#11

Re: Schwarzanteil eines TImage ermitteln

  Alt 30. Dez 2008, 09:53
Bei mir bleibt der Wert auf Null.

Quellcode:
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var
  i,j : Integer;
  blackCount: Integer;
begin
  blackCount := 0;
  for i:= 0 to image1.Picture.Bitmap.Height -1 do
    for j:=0 to image1.Picture.Bitmap.Width -1 do
     if image1.Picture.Bitmap.Canvas.Pixels[j,i] = clBlack then
       inc(blackCount);
       Label1.Caption := '';
       Label1.Caption := (IntToStr(blackCount));
end;
Miniaturansicht angehängter Grafiken
unbenannt_405.jpg  
  Mit Zitat antworten Zitat