![]() |
Re: Schwarzanteil eines TImage ermitteln
Liste der Anhänge anzeigen (Anzahl: 1)
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; |
Re: Schwarzanteil eines TImage ermitteln
Liste der Anhänge anzeigen (Anzahl: 1)
.. kannst Du das Bild mal anhängen
Grüße Klaus |
Re: Schwarzanteil eines TImage ermitteln
Zitat:
:wiejetzt: |
Re: Schwarzanteil eines TImage ermitteln
Achso.
Das Programm ließt nur den Schwarzanteil von Bitmaps. Danke für eure Hilfe. Es leuft jetzt. :mrgreen: |
Re: Schwarzanteil eines TImage ermitteln
.. noch als Nachschlag:
Wenn ich das jpg lade verschwindet das Bild auch bei mir. Ich habe den Code dann so angepasst, dann klappe es auch mit jpg.
Delphi-Quellcode:
Grüße
procedure TForm1.Button1Click(Sender: TObject);
var i,j : Integer; blackCount: Integer; jpg : TJpegImage; begin blackCount := 0; jpg := TJpegImage.Create; jpg.LoadFromFile('d:\unbenannt.jpg'); image1.Picture.Bitmap.Assign(jpg); jpg.Free; 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); edit1.Text:=FloatToStr(blackCount/((i+1)*(j+1))); end; Klaus |
Alle Zeitangaben in WEZ +1. Es ist jetzt 00:01 Uhr. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO © 2011, Crawlability, Inc.
Delphi-PRAXiS (c) 2002 - 2023 by Daniel R. Wolf, 2024-2025 by Thomas Breitkreuz