procedure CannyCore(dc, width, height, upper, lower: integer);
function MaxGroupCenter(points: TPointArray; Length, MaxDist: Integer): Integer
function GroupCentersMin(points: TPointArray; Length, MaxDist, MinPts: Integer): Integer;
function GroupCenters(points: TPointArray; Length, MaxDist: Integer): Integer;
function FindColorsFast(dc, sx, sy, ex, ey: Integer; points: TPointArray; Length, Color, Tolerance: Integer): Integer
function FindBlobs(dc, sx, sy, ex, ey: Integer; points: TPointArray; Length, Color, Tolerance, MaxDist, MinPts: Integer): Integer;
CannyCore edge detects a bitmap.
MaxGroupCenter finds the group with the highest number of points in it whose points are no greater than MaxDist apart.
GroupCentersMin finds groups whose points are no greater than MaxDist apart, and have at least MinPts points in them.
GroupCenters finds groups whose points are no greater than MaxDist apart.
FindColorsFast does exactly what it says it does.
FindBlobs is a blob detection algorithm, essentially FindColorsFast + GroupCentersMin but faster than using them separately.
Since the plugin is in c++ I can't create delphi arrays, so you allocate an array on the script side, and the procedure returns the number of indexes used, so you do this:
function FindColors(sx,sy,ex,ey,color,tolerance: integer): TPointArray;
var
w, h: integer;
begin
w:= ex-sx;
h:= ey-sy;
SetLength(Result, w*h);
SetLength(Result, FindColorsFast(GetClientCanvas.handle,0,0,w,h,Result,w*h,color,tolerance));
end;
And, on that topic, this FindColors took 12.03 ms on average (at any tolerance) to find colors over a 765x503 area. Comparatively, the Scar FindColors method took 47.5ms at 5 tolerance, 121.57ms at 255, and 130.31ms at 442 tolerance… I have no idea why the Scar procedure changes time taken at different tolerances, but thats what I observed…
Also, I tested the blob detector looking for Mith rocks and it averaged out 29.37ms per search. Ironically, thats FASTER than Scar can return an array of the Mith colors XD. I'll try to upload this after I finish my homework or tomorrow perhaps, just an update. And, please come up with some more stuff, I'm having fun :) That in mind, I might write a corner detector, but I believe a Line detector is a wast of time. I've got one written, and I might include it anyway if I can get it working faster.
BTW: The edge detector is down to 50ms for the entire process from Raw Image -> Edge Detected Image :D