Log in

View Full Version : Change in color in a box.



Main
02-08-2011, 06:01 AM
Is there a function that counts all the colors in a box (For a certain duration or a instant) and returns as a integer or something comparable?

Example:
A area of chicken where all the color is constant but they move and such, but once a person walks in it realizes there is a new color or a change in sum of the color and do something.. My actual use is something for real life, so reflection won't work he.


I am not too aware of wizzyplugin but I can't find any thing that do this. I appreciate all the help I can get:P

i luffs yeww
02-08-2011, 06:16 AM
Yes, there is. Check out PixelShift or something.

Main
02-08-2011, 06:22 AM
mkay. It doesn't solve my problem thou. Am looking for a something that would point out if a new color popus up in a area of other colors.

KingKong
02-08-2011, 07:22 AM
The only way I can think of is get the colors of all the pixels and store them in an array removing the duplicate colors, then after a while get all colors and store again removing the duplicates, then see if any new colors have appeared. (Yes, i know this isn't the fastest, but the only way I can think of)

Bonfield
02-08-2011, 07:50 AM
something like this? (http://villavu.com/forum/showthread.php?p=772779#post772779)

i luffs yeww
02-08-2011, 07:56 AM
Oh, sorry, I didn't read the question at all.

What you should do is just get a few small boxes and check the colors in each of them, store the colors, and then check them again. Any changed colors (with a certain tolerance, if you so please) would be done whatever you want with.

if(NewColor[x][y] <> OldColor[x][y])then Writeln('Color ' + ToStr(NewColor[x][y]) + ' is new at point ' + ToStr(x) + ', ' + ToStr(y) + '. (Replaced color ' + ToStr(OldColor[x][y]) + '.)');

or something.

Main
02-08-2011, 08:18 AM
@Bon
Yeah definately, except mine is used for real life and I could do without the tpa out of bound. Unfortunately I am not sure what excalty is going on in fawki's script but I will try to learn it.

@i luff,
What am looking for is somthing like motion tracking, except it tracks new colors. I will try your ideas and see how it goes.


If this could work, it could be motion tracking on scar heheh.

Bonfield
02-08-2011, 08:21 AM
real life? so what do you want to use this for?

TomTuff
02-08-2011, 08:26 AM
It sounds like Main Ftw wants to make a keylogger/mouse tracker, lol

Main
02-08-2011, 08:29 AM
Track movement of cans for my uni project. Besides, it could be fun:P I got it to work with tracking objects with certain color, but constantly adjusting the color of objects is quite annoying, so it would be nice for tpa to sums up the colors or constantly record and detect if a new color comes into the area.

Also, it would be AWSOME if scar can draw canvas on regular screens hehe.


EDIT: I wasn't thinking about keylogging tomtuff, but it could be (from my other thread). I was intending to make little form alarm clock. Also, didn't benland or someone made a keylogger? (Gonna go an run to check the get key hehe (http://villavu.com/forum/showthread.php?t=3197)).

i luffs yeww
02-08-2011, 08:34 AM
Neither Simba or SCAR would be able to handle this.

TomTuff
02-08-2011, 08:46 AM
I wasn't thinking about keylogging tomtuff, but it could be (from my other thread). I was intending to make little form alarm clock. Also, didn't benland or someone made a keylogger? (Gonna go an run to check the get key hehe (http://villavu.com/forum/showthread.php?t=3197)).

There was no real seriousness to what I had said, it's just funny that you want to do movement tracking and detecting when a key is down without a huge for..to..do loop.

Main
02-08-2011, 09:01 AM
The color thing gotta be fast, cause the project involvs stuff accelerating in 0.5-1 G hehe. Its been good with web cam just but if i can find new colors it would be much better.

i luffs yeww
02-08-2011, 10:02 AM
Again, you can't do this with SCAR/Simba.

Sir R. M8gic1an
02-08-2011, 12:05 PM
Just have an array of all the colors that you've found which will make it easy for you to detect if any new colors showed up.

Pure colors (tol 0) is the best way to go, because yagex's coloring system starts from those colors and then they apply a coloring algorithm to their models.

Check SmartColors, there's a function in there that captures the pure colors and returns it to the SC record.

As for detecting new colors, anything that goes too far beyond the average rgb of the pure colors would probably mean there's a new pure color around.

As I've said before, I wish I could look at their coloring algorythm. cts 2 is a great way to go about finding new colors / keeping track of colors tbh. Never tried scar's cts 3 tho. I still need to read up on that.

~RM

i luffs yeww
02-08-2011, 12:18 PM
RM, he wants to do this with a camera + real life objects.

Sir R. M8gic1an
02-08-2011, 12:22 PM
RM, he wants to do this with a camera + real life objects.

yeh well RS teaches u somethin bout real life doesnt it? its all hacking / color finding anyway ;)

~RM

i luffs yeww
02-08-2011, 12:49 PM
Just sayin', it will be a bit different.

And you can't do this in SCAR/Simba.

Main
02-08-2011, 09:03 PM
Isn't there a way to compare if a color is in a tpa without specific coordinate?

Like I'll find all the color within a given area, and I get a new color poping out, it compares it with all the pre-recorded colors in the area and see if it matchese or not.

EDIT: Rofl nvm.

3Garrett3
02-08-2011, 10:02 PM
Just sayin', it will be a bit different.

And you can't do this in SCAR/Simba.

Why not?

Nava2
02-08-2011, 10:12 PM
Why not?

The speed required for realtime image processing is nuts.

Main
02-08-2011, 10:48 PM
Am trying to detect stuff like this through my web cam.
http://img211.imageshack.us/img211/6715/33467993.png

http://img843.imageshack.us/img843/4926/26938957.png


What we are actually trying to do is to automatically count number of cans that go through a straight transparent pipe. It works well with my test can (red) and on a white wall. But when every thing is completed, the can will be surrounded by other colors of the machine and the color of the can might be different.

Thats what am trying to solve.

Boreas
02-09-2011, 04:41 AM
Do you just need the total number of cans passed? Or you need to know how many blue cans passed and how many red cans passed? Will the camera be stationary relative to the pipe, and will the background behind the pipe by static?

Sir R. M8gic1an
02-09-2011, 06:12 AM
I'm a bit out of my depth here, but I think you'd want to figure out how to remove noise from the image, or at least read up on such concepts.

I would guess that the image you posted adds up to about 7 pure colors, and if you'd want to count red & blue cans going through a pipe then first you'd want to find the pipe, isolate it, get an area around it and then monitor for changes in that area.

Blue and red are just two more colors to deal with, with another 'color' (trasparent) on top.

Blue mixed with transparent and red mixed with transparent would probably make a new pure color in itself, because the image is 2D. Not 100% sure, but I think the logics are on the right path.

~RM