OS-Bot-COLOR
OS-Bot-COLOR copied to clipboard
runelite_cv.py -> extract_objects() deduplication
Is your feature request related to a problem? Please describe. In my using of this function, I've encountered the problem of it detecting a single RuneLiteObject as being multiple, i.e. it spits out a List with duplicates in it.
Describe the solution you'd like deduplication.
Describe alternatives you've considered
In my local copy I've patched the function like so:
before creating the RuneLiteObject and added it to the List objs
, I run a check comparing its euclidean distance (np.linalg.norm is very fast) between centers to every other RLO in objs
currently. If it's less than 10 pixels, I chuck it instead of appending.
My setup is a bit different to yours, I just snagged this function, so this isn't a direct drag-and-drop patch, but here's the code I have in my local copy to explain the idea. This has totally eradicated my duplicate problem.
if len([o for o in objs if o.distanceToPoint(Point(center[0],center[1])) < 10]) == 0:
objs.append(RuneLiteObject(x_min, x_max, y_min, y_max, width, height, center, axis, self.client))