AGB  ·  Datenschutz  ·  Impressum  







Anmelden
Nützliche Links
Registrieren
Thema durchsuchen
Ansicht
Themen-Optionen

Scanline Schleife sehr langsam!?

Ein Thema von chrizl08 · begonnen am 15. Sep 2008 · letzter Beitrag vom 16. Sep 2008
Antwort Antwort
Flips

Registriert seit: 17. Feb 2005
Ort: Sankt Wendel
491 Beiträge
 
Delphi 7 Professional
 
#1

Re: Scanline Schleife sehr langsam!?

  Alt 15. Sep 2008, 14:47
Zitat von chrizl08:
Delphi-Quellcode:
Function FindColor(bmp:TBitmap):TPoint;
type
  PixArray = array[1..3] of Byte;
var
  i, iMax, x, y, w, h: Integer;
  p : ^PixArray;
begin

  Result:=Point(-1,-1);

  Form1.ProgressBar1.Max := bmp.Height-1;

  for y := 0 to bmp.Height-1 do begin
    p := bmp.ScanLine[y];
    Form1.ProgressBar1.Position := y;
    for x := 0 to bmp.Width-1 do begin
      if( (p^[3]=255) AND (p^[2]=0) AND (p^[1]=0) ) then begin
        Showmessage('Gefunden');
        Result := Point(x, y);
        exit;
      end;
    end;
  end;
end;
Der Code kann auch gar nicht ordentlich funktionieren,
in die innere Schleife muss noch ein inc(p)!


[Edit]
Mit einer Schleife gehts auch, was folglich auch schneller sein sollte (nur als Beispiel):
Delphi-Quellcode:
procedure TForm1.Button1Click(Sender: TObject);
var i : integer;
p:^TRGBTriple;
begin
image1.picture.bitmap.PixelFormat := pf24Bit;
with image1.picture.bitmap do
  begin
    p := scanline[height-1];
    for i := 0 to (height*width)-1 do
      begin
        if p^.rgbtRed = $FF then
          ShowMessage('ja');
        inc(p);
      end;
  end;
end;
[/Edit]
Philipp F.
  Mit Zitat antworten Zitat
Antwort Antwort


Forumregeln

Es ist dir nicht erlaubt, neue Themen zu verfassen.
Es ist dir nicht erlaubt, auf Beiträge zu antworten.
Es ist dir nicht erlaubt, Anhänge hochzuladen.
Es ist dir nicht erlaubt, deine Beiträge zu bearbeiten.

BB-Code ist an.
Smileys sind an.
[IMG] Code ist an.
HTML-Code ist aus.
Trackbacks are an
Pingbacks are an
Refbacks are aus

Gehe zu:

Impressum · AGB · Datenschutz · Nach oben
Alle Zeitangaben in WEZ +1. Es ist jetzt 13:22 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