Results 1 to 7 of 7

Thread: Sorting a Matrix/Bitmap into TPAs by color

  1. #1
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default Sorting a Matrix/Bitmap into TPAs by color

    Hello!

    So I got back into scripting on RS3 as I want to have an early start for the upcoming competition. I found this great method for XP that you can use from scratch. Anyways back to topic. I am attempting at filtering out the background in order to bring out distinct objects in the foreground.




    So I've Posterized a bitmap and stored it as a matrix. And what I essentially wish to do is sort them by color into an ATPA. From there on I cluster each each of the TPAs in the ATPA, and filter out the larger ones. So what I am left with are those colors that are only found in small quantities of clusters. In the picture provided this would e.g. be the players, the goblins or the bones.

    But my problem is that the way I'm doing it now it's crazy slow. This takes up to a second to perform. So what I am asking is: is there any Simba native stuff that can sort it into TPAs by color. If not do you have any advice on how I could speed this up?

    EDIT: I'd also like to note that I can't just filter X colors out, as they sometime changes. So I have to filter them based off the occurrence of colors.
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  2. #2
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    This looks interesting! Operating on so many points is going to be pretty slow unless you can find a native function or use a plugin, which you can't for this competition. I'm about to go to work, but I'll mess around with this when I get home.
    I've done some similar things that I'll have to dig up. I assume you're trying to isolate the NPCs, not the loot? There might be some easier ways to do that. e: like motion detection
    Anyway, I'll check back later. Unless someone smarter than I has a better solution (likely). e: see olly's post
    Last edited by Citrus; 12-05-2016 at 03:13 AM.

  3. #3
    Join Date
    Feb 2011
    Location
    The Future.
    Posts
    5,600
    Mentioned
    396 Post(s)
    Quoted
    1598 Post(s)

    Default

    Quote Originally Posted by Joopi View Post
    Hello!
    ...


    You already have the background colours. What if you did: RemoveTPAFromTPA or something to that effect? It'll remove the background points from the array then you can sort the resulting smaller array?
    I am Ggzz..
    Hackintosher

  4. #4
    Join Date
    Nov 2011
    Location
    England
    Posts
    3,072
    Mentioned
    296 Post(s)
    Quoted
    1094 Post(s)

    Default

    http://pastebin.com/XnP7Vsbw - Takes 70ms for me.

  5. #5
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    @Citrus;
    What approach are you using in the .gif provided? Are you doing posterizing or motion detection here?

    Because I was thinking of using posterizing to grab the background colors, and then use motion detection and filter away the background that also moves based on that. Maybe I am overthinking this a bit but it's fun playing around with these tools.
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

  6. #6
    Join Date
    May 2012
    Location
    Glorious Nippon
    Posts
    1,011
    Mentioned
    50 Post(s)
    Quoted
    505 Post(s)

    Default

    Quote Originally Posted by Joopi View Post
    @Citrus;
    What approach are you using in the .gif provided? Are you doing posterizing or motion detection here?

    Because I was thinking of using posterizing to grab the background colors, and then use motion detection and filter away the background that also moves based on that. Maybe I am overthinking this a bit but it's fun playing around with these tools.
    I didn't do any posterization, just motion/pixel shift detection.
    I don't know much about what goes into posterizing an image, but it doesn't seem too useful for RS-related scripts.

  7. #7
    Join Date
    Sep 2014
    Location
    C:\Simba\
    Posts
    565
    Mentioned
    9 Post(s)
    Quoted
    71 Post(s)

    Default

    Ah I see. I think it could find some use if I were to make some "AI" that would essentially just collect colors and make guesses. It's useful for gathering similar colors that you could then create a hsl profile for.
    Feel free to ask me any questions, I will do my best to answer them!

    Previously known as YouPee.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •