Cazax
2009-02-03 11:06:38
I have been thinking about an idea for better symbol finding, which consists on replace the bitmaps for color finding and counting lengths. Here it is an example(to find a bank):
Function FindBankMM(Var TP : TPoint): Boolean;
Var
TPA : TPointArray;
ATPA : T2DPointArray;
Box : TBox;
I, H, Len : Integer;
X : Extended;
Begin
FindColorsTolerance(TPA, 2083034, MMX1, MMY1, MMX2, MMY2, 15);
If Length(TPA) = 0 Then
Exit;
ATPA := TPAtoATPA(TPA, 10);
SortATPAfrom(ATPA, Point(MMCX, MMCY));
H := High(ATPA);
For I := 0 To H Do
Begin
Box := GetTPABounds(ATPA[I]);
Len := CountColorTolerance(2083034, Box.X1, Box.Y1, Box.X2, Box.Y2, 15);
X := Len Div 17;
If SymbolAccuracy <= X Then
Begin
Try
TP := TPA[0];
Except
Exit;
End;
Result := True;
End;
End;
End;It is very effective and fast, while FindSymbol takes between 150-200 ms finding a symbol this function takes between 0-15 milliseconds.