Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FindFishingSpot(scanTime: Int32=500): T2DPointArray;
- var
- i: Int32;
- SUM,TPA,u: TPointArray;
- tmp: T2DPointArray;
- t: Double;
- begin
- t := PerformanceTimer() + scanTime;
- // this is the new magic, we find the sea btw:
- // we extract lone pixels, pixels that are alone and not connected to other pixels
- // we only stack those! So basically we want the pixel noise, nothing else.
- while PerformanceTimer() < t do
- begin
- TPA := Target.FindColor(ColorTolerance($A0816E,3.000,EColorSpace.HSL, [2.183,0.540,0.278]));
- tmp := TPA.Grow(1).Difference(TPA).Cluster(2);
- SUM += tmp.ExcludeSize(1, __GT__).Merge();
- end;
- Result := SUM.Grow(1).Cluster(5);
- Result := Result.ExcludeSize(100, __LT__);
- for i:=0 to High(Result) do
- begin
- img.DrawColor := Random($FFFFFF);
- img.DrawTPA(Result[i]);
- img.DrawCircleAA(Result[i].MinAreaCircle().Center, Result[i].MinAreaCircle().Radius);
- end;
- end;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement