SRL Archive - RS3 Help

Best way to find detect trees and only tree?


yourule97

2014-09-12 09:12:43

Hi, I'm pretty new to this language, but I've been following Mayor's tutorial step by step but instead with trees. However, trees are a generic brown color and every time I try to adjust the color values, I still get like 100 boxes on my screen.


findColorsSpiralTolerance(x, y, TPA, 2572356, mainScreen.getBounds(), 9, colorSetting(2, 0.56, 1.88));

if length(TPA) < 1 then
exit;

ATPA := TPA.toATPA(30, 30);
ATPA.filterBetween(0, 10);
ATPA.sortFromMidPoint(mainscreen.playerPoint);
smartImage.debugATPA(ATPA);

My other idea was to only find dead trees and chop those, but the ground near dead trees happens to be a similar color to those trees.

Thanks for the help!

riwu

2014-09-12 09:36:10

Post a screenshot of the trees and its surrounding, mayb we can help.
Also is 30 a bit too high for grouping the tpas?

rj

2014-09-12 09:52:27

From: riwu
Post a screenshot of the trees and its surrounding, mayb we can help.
Also is 30 a bit too high for grouping the tpas?


I prefer clusterTPA tbh


tpa.cluster(4)

all colors of the tpa within a 4 point distance of each other will be grouped

riwu

2014-09-12 10:08:38

From: Robert
I prefer clusterTPA tbh


tpa.cluster(4)

all colors of the tpa within a 4 point distance of each other will be grouped

I always use splittpa/floodfilltpa. i guess he followed mayor's tutorial.
I haven't used srl6 for several months so no idea what those wrappers refer to.
hmm apparently ClusterTPA() is 'extremely fast compared to SplitTPA with a distance less than 100'.
gotta read up those simba changelogs..

EDIT: just did a simple test ClusterTPA() is almost always slower than SplitTPA() unless the points are all extremely close together…

yourule97

2014-09-12 10:59:08

Cluster seems to work pretty well, thanks for the help! I didn't have much time to play around with it, but I'll spend some more time working on it today. I might have to actually force myself to read documentation, but I hate it so so much.

slacky

2014-09-12 11:59:29

From: riwu
I always use splittpa/floodfilltpa. i guess he followed mayor's tutorial.
I haven't used srl6 for several months so no idea what those wrappers refer to.
hmm apparently ClusterTPA() is 'extremely fast compared to SplitTPA with a distance less than 100'.
gotta read up those simba changelogs..

EDIT: just did a simple test ClusterTPA() is almost always slower than SplitTPA() unless the points are all extremely close together…

ClusterTPA is written to be able to cluster large arrays in minimal time. For small arrays SplitTPA is the better option. ClusterTPA has "a lot" of initalization-overhead, making it slower than SplitTPA when clustering small arrays. Array-size, distance, and spread are the main factors to how well ClusterTPA performes, the greater the distance is the slower ClusterTPA becomes. The spread of the points will affect the initialization-time, and some of the processing, this will be notable when the arrays are SMALL.

riwu

2014-09-12 19:11:51

From: slacky
ClusterTPA is written to be able to cluster large arrays in minimal time. For small arrays SplitTPA is the better option. ClusterTPA has "a lot" of initalization-overhead, making it slower than SplitTPA when clustering small arrays. Array-size, distance, and spread are the main factors to how well ClusterTPA performes, the greater the distance is the slower ClusterTPA becomes. The spread of the points will affect the initialization-time, and some of the processing, this will be notable when the arrays are SMALL.

Well in official RS the arrays generally tend to be small (~10 - 200), and some points could scatter far apart. So it's very seldom that ClusterTPA() will be faster than SplitTPA() if you are coding for RS.

slacky

2014-09-12 19:52:02

From: riwu
Well in official RS the arrays generally tend to be small (~10 - 200), and some points could scatter far apart. So it's very seldom that ClusterTPA() will be faster than SplitTPA() if you are coding for RS.

Indeed. As long as one keep doing the same simple thing over and over again you will probably never need ClusterTPA :p

But once you do something a bit more involved, IE, like I did here some years ago, SplitTPA becomes useless:

Extracting the blue and…
a: Splitting that (SplitTPA): takes around 4 seconds
b: Clustering that (ClusterTPA): takes around 10 ms:smile:

TylerT

2014-09-12 20:04:19

From: slacky



Is there a thread where I can see more of this?

Incurable

2014-09-12 22:41:10

From: yourule97
Cluster seems to work pretty well, thanks for the help! I didn't have much time to play around with it, but I'll spend some more time working on it today. I might have to actually force myself to read documentation, but I hate it so so much.


Don't be like that! Documentation is like a lover that you just can't turn away. She knows how to hit all of your buttons, and she wants to help you in any way you ask of her. Don't hate Documentation, instead love her back as much as she loves you. ;)

slacky

2014-09-12 22:42:56

From: TylerT
Is there a thread where I can see more of this?

no there is not.

The Mayor

2014-09-12 22:52:04

From: slacky



That feel when I know that's Draynor with an east facing compass :D

TylerT

2014-09-12 23:24:27

From: slacky
no there is not.


o. well thats a god damned shame because it looks super interesting lol.