Advertisement
WarPie90

[RS]Find fishing spots [2024 edt]

Jul 5th, 2024 (edited)
1,121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 0.94 KB | None | 0 0
  1. function FindFishingSpot(scanTime: Int32=500): T2DPointArray;
  2. var
  3.   i: Int32;
  4.   SUM,TPA,u: TPointArray;
  5.   tmp: T2DPointArray;
  6.   t: Double;
  7. begin
  8.   t := PerformanceTimer() + scanTime;
  9.   // this is the new magic, we find the sea btw:
  10.   // we extract lone pixels, pixels that are alone and not connected to other pixels
  11.   // we only stack those! So basically we want the pixel noise, nothing else.
  12.   while PerformanceTimer() < t do
  13.   begin
  14.     TPA := Target.FindColor(ColorTolerance($A0816E,3.000,EColorSpace.HSL, [2.183,0.540,0.278]));
  15.     tmp := TPA.Grow(1).Difference(TPA).Cluster(2);
  16.     SUM += tmp.ExcludeSize(1, __GT__).Merge();  
  17.   end;
  18.  
  19.  
  20.   Result := SUM.Grow(1).Cluster(5);
  21.   Result := Result.ExcludeSize(100, __LT__);
  22.  
  23.   for i:=0 to High(Result) do
  24.   begin
  25.     img.DrawColor := Random($FFFFFF);
  26.     img.DrawTPA(Result[i]);
  27.     img.DrawCircleAA(Result[i].MinAreaCircle().Center, Result[i].MinAreaCircle().Radius);
  28.   end;
  29. end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement