SRL Archive - SRL Archives

Does SCAR NEED this?


piv

2007-06-06 02:40:01

I know there are currently a lot of problems with changing colours etc, and that dtms only work on colours… and I've always thought we need to use more than colours. Hence, I had a little google on edge detection and knocked up a script over the past 24 hours. The result is attached.

Obviously if people deem this a decent idea I could write functions to find deformed, rotated edges etc. Combined with colours and dtms there's not much you can't find.

If this seems useless.. think box, maze, mime solver (detect shapes, detect gates, arms etc)

Feedback please :redface:

Wizzup?

2007-06-06 02:48:25

From: piv
I know there are currently a lot of problems with changing colours etc, and that dtms only work on colours… and I've always thought we need to use more than colours. Hence, I had a little google on edge detection and knocked up a script over the past 24 hours. The result is attached.

Obviously if people deem this a decent idea I could write functions to find deformed, rotated edges etc. Combined with colours and dtms there's not much you can't find.

If this seems useless.. think box, maze, mime solver (detect shapes, detect gates, arms etc)

Feedback please :redface:


I like the idea, although I don't fully understand what the picture has to do with it, except for that it looks like a mask.. :)
Did you make a script to detect edge's of objects on this .jpg?

piv

2007-06-06 06:30:19

Pic is showing the output of the script. It's an implementation of the Canny edge detection algorithm, without the gaussian mask since the rs client obviously doesn't have any noise in the image.

http://en.wikipedia.org/wiki/Canny

As a dll it will run fast enough to work in real time, currently takes a few seconds to produce that image. The fundamental idea is you can detect objects that are otherwise impractical or impossible to detect using colours, the most obvious example being the gate in the maze (see pic) Ideally you'd have a screen in scar similar to the DTM editor. You'd simply select what you want it to detect and save that as what you want to search for. From there it works the same as any other searching function, including deformation and rotation.

This would also work excellent on the map for walking functions, without variables being passed from java reflection (that's cheating you know :P).

Put simply - this will enable scar to detect objects via shapes, not just colour alone. Hence, a box, maze and mime solver are all feasible.

Edit: forums are obviously shrinking the attachments, but you get the idea. It's dead obvious where the gates are, and I can explain how to solve the maze in words if someone desperately wants to code it, otherwise I may do it in a few weeks after exams.

asdf

2007-06-06 07:04:03

Awesome stuff Piv. This looks very handy indeed, I can see how it would be good for a box solver.

Markus

2007-06-06 10:53:07

Markus recognizes the ranger on the pic :)
This looks very promising. Could you please tell your method of solving the maze?

[offtopic]
Looks like you have no reward left, be sure to open some chests so I at least get some reward.
[/offtopic]

piv

2007-06-06 23:14:58

You can detect your location in a hallway on the map, and where the center is. Rotate your camera to face the center, walk the longest way along the hall and open gates along your way. The logic involved isn't difficult.

And btw big thanks to markus letting me borrow a character currently in the maze. Wouldn't be able to start on a maze solver without this.

Cheesehunk

2007-06-07 00:11:32

Excellent stuff piv!:) Are you planning on releasing the plugin, or are you still perfecting it? Crazy, When you think SCAR's at its peak, Ben, pups, and piv start making stuff like SCAR is just in it's beginning stages.

piv

2007-06-07 00:24:34

It's currently a pile of shit haha, really crude code but it works. I'm just kinda gauging if there is a demand for this. If i go to the effort to make searching functions and make it fast enough, will you guys actually use it?

Ben is a gnarly little maths kid, haven't spoken to pups for ages, and as for myself… I'm just me.

I googled for this stuff like a year ago and couldn't find anything solid, there's a ton of websites with good explanations of computer vision now. It's a sweet subject. If my uni ran it… it'd probably dump engineering hehe.

Dark_Sniper

2007-06-07 00:25:27

From: Cheesehunk
Excellent stuff piv!:) Are you planning on releasing the plugin, or are you still perfecting it? Crazy, When you think SCAR's at its peak, Ben, pups, and piv start making stuff like SCAR is just in it's beginning stages.


well if you have not noticed it kind of goes in a circle around the year…


summer is when everyone is most active…

every other time people are busy with stuff… and possibly school.


this is some great stuff <3 it.

Markus

2007-06-07 06:20:21

From: piv
And btw big thanks to markus letting me borrow a character currently in the maze. Wouldn't be able to start on a maze solver without this.


It's ok. Just create an awesome maze solver that owns.

And the shape detection stuff might be usefull for an evil bob solver…

piv

2007-06-07 09:53:17

Update: this needs to become a dll to continue. In terms of computer processing power this isn't straining by any means but it's pushing scar to its limits. To put it in perspective, the guts of it is less than 100 lines of code and its taking 30 seconds to generate an image, and I'm not running a gaussian mask first to get better results - that may double the time. It's mainly due to hammering through 2d arrays, and the fact that the actual arctan function was left out of scar, making the trig incredibly slow. Ive downloaded a few programs that use the same algorithm and produce the same result from a webcam so it's not dodgy code. That's just to generate the image, not even begin searching.

I'd like to write some searching functions and release this soon but its just not feasible to test if it takes 30 seconds plus each time.

Promise to keep you updated kiddos. I'll see what I can do by downloading delphi overnight.

Killerdou

2007-06-07 10:00:40

i guess you should talk to freddy:) if there is anyway of putting into scar its via him;)

USMC

2007-06-07 14:15:19

this looks like a mask?
there is already a bitmap mask function?

Markus

2007-06-07 14:31:02

A mask shows you where certain colors are. This is more like edge detection, it detects objects.

Smartzkid

2007-06-07 20:19:12

Yes; SCAR needs this. I could come up with a great amount of uses for it.

This would be to object finding what DDTMs are to walking


Just one question…would there be any way to make it 3d? That way it'd work from any camera angle.

I know 3d is possible in SCAR, I just don't know how laggy it would be…probably extremely laggy….

masquerader

2007-06-08 00:05:32

hey piv
im glad to see youre still around
how long has it been since you started? 3-4 years? haha
it seemed like you were already an old timer when i had just started, way back at kaitnieks in like 2005 :)

anyway, i think the spot where edge detection would be the most useful would be in reading the text in the top left

it is difficult because the font is slightly transparent and it is hard to set the tolerance, so a lot of people are frustrated with it

i think edge detection could separate the letters very easily and make for accurate text reading
it would also be pretty fast because it would only require edge detection on like a 100x8 rectangle

side: do you live in the us? do you have msn?

piv

2007-06-08 01:20:35

Fuck's sake… just typed a huge post and accidently closed the window. Let's do it again…

Smartzkid…
-It could be done in 3d, rotated about the xplane (into the screen), but I don't think it's necessary or useful, and it would be confusing as hell to use. I think regular 2d deformation will be enough.
-Edit: lag - this thing decides how long it takes, anywhere up 40 seconds. Scar is great for simple logic, like check a colour and click, wait a bit, check again, but not for using calculus and trig on 2d arrays.

masquerader…
-I think I've been around since early 2002, so 5 years or more? I'm a veteran that's seen it all.
-Edge detection should work on the text by fiddling with tolerances and perhaps a slight gaussian mask. I thought at first a gaussian mask wasn't necessary but it's looking that it may be. Little tiny rocks and bits of grass keep showing up.
-I do have msn but dont like to keep many rs people on it, not a personal thing sorry.

Delphi downloaded overnight… I'll get in touch with freddy soon and see what he thinks or lets me do.

ruler

2007-06-08 15:24:39

I wrote a custom edge detector that is very crude and specifically for rs.

AutoTolerance 4:
http://www.rscheata.net/images/4.PNG
AutoTolerance 39:
http://www.rscheata.net/images/39.PNG

Takes about 150ms to do a game screen.

We use edge detection on all object finding now.

To reduce the 150ms footprint we instead only check 1 out of 36 pixel.
thus 150/36 ms.

Next we add our RGBCluster functions.

gather 10 points:
http://www.rscheata.net/images/c2.PNG

We dont do shape recognition

You can probably only need a SCAR dll function that takes like 500ms. With everyone buying dual core machines now and with most people only running one scar. Have rs on one core and scar on anouther.

Freddy1990

2007-06-08 16:02:01

Nice approach piv, I might look into that after my exams are over *adds to todo list*

And erm ruler, it's not nessecarilly 500ms, delphi functions can easilly be optimised to work extremely fast given the right ammount of experience…

ruler

2007-06-09 02:18:54

From: Freddy1990
Nice approach piv, I might look into that after my exams are over *adds to todo list*

And erm ruler, it's not nessecarilly 500ms, delphi functions can easilly be optimised to work extremely fast given the right ammount of experience…

http://shootout.alioth.debian.org/gp4/benchmark.php?test=all&lang=all
Assuming they call it " Pascal Free Pascal"

I would estimate about 2 times faster but with 2 times the number of lines compared to Java.

piv

2007-06-09 03:51:21

From: Freddy1990
Nice approach piv, I might look into that after my exams are over *adds to todo list*

And erm ruler, it's not nessecarilly 500ms, delphi functions can easilly be optimised to work extremely fast given the right ammount of experience…


Thanks.. added you to msn but you're obviously busy with study etc. I'll chat with you when you're available.

Ruler, that first one looks very much like the second derivative of luminosity. I did that and it's fast as hell but gives dodgy results obviously.

Might look at some other algorithms in the mean time…

BenLand100

2007-06-09 21:34:00

From: piv
Ben is a gnarly little maths kid, haven't spoken to pups for ages, and as for myself… I'm just me.

Was that a compliment XD By the way, I started this about a year ago, assuming I've still got what I did I can send it to you if you'ed like. I believe the dll I wrote was pretty fast, can't remember though ;)
Edit: Yea, I did more than I realized, got into houghe (sp) transfoms and the like. I can't believe the devs don't remember this… Guess its true that no one likes me :duh: Anywho, finding the triangle took 0.328 seconds (And that is with excess processing for debug output, along with other stuff besides edge detection, and shapefinding transforms, Ruler :p The edge detection took 100ms total), give or take 15 ms.
Dunno how long this one took, it was saved in the folder however. Thats the binary output, grayscale is much more interesting ;) Also, that was with a really low threashold.

piv

2007-06-10 01:11:51

Certainly was a compliment haha..

Why was this ignored when benland did it :duh: :duh: :duh:

I came across the Hough transforms but didn't think much of them. I've added you to msn, I'd love to see what you've done.

Wizzup?

2007-06-10 03:31:55

From: piv
Certainly was a compliment haha..

Why was this ignored when benland did it :duh: :duh: :duh:

I came across the Hough transforms but didn't think much of them. I've added you to msn, I'd love to see what you've done.


Pups made a boxsolver in 3 days, before Benland did, Benland was working on it for a long time already though.

Lorax

2007-06-10 04:41:20

The question has already been answered Piv,
you know BenLand is this little math kid that no one understands.
So because we don't understand we just do like: "mmhm, yeah, woaw, jubii, hello, mmhm, yea, neat, hey, juhu" or stuff like that, so it goes in one of the eyes and out the other ;)

BenLand100

2007-06-10 05:51:00

From: Wizzup?
Pups made a boxsolver in 3 days, before Benland did, Benland was working on it for a long time already though.

What you are neglecting to mention is that he was trying to write a box solver, I was trying to learn and apply what i’ve learned to something i was famalier with. The map location finding was another good, although unexplored, idea.
(There, I posted it :p Almost a direct quote too)

piv

2007-06-10 06:08:03

From: BenLand100
What you are neglecting to mention is that he was trying to write a box solver, I was trying to learn and apply what i’ve learned to something i was famalier with. The map location finding was another good, although unexplored, idea.
(There, I posted it :p Almost a direct quote too)


Wasn't really the boxsolver, although I'm not attacking pups by any means. It was the concept of edge detection which in my opinion should never have been overlooked.

After downloading a 300mg french version of delphi and another 600 mg version that wouldnt install i found a better 40mb version that worked straight up :rolleyes:

Now to fiddle with plugins…

piv

2007-06-22 04:22:24

Finals over.. got a 3 week break. In between trying to earn a $3000 i'll write the plugin :)

Janilabo

2007-06-22 05:32:31

From: piv
Finals over.. got a 3 week break. In between trying to earn a $3000 i'll write the plugin :)
Very nice to hear piv! :)