Jump to content

Recommended Posts

Posted (edited)

I would like to somehow make a type of motion detect system that will perform specific functions when there is movement on certain areas of the screen. I've searched around, and it appears this has never been done before, so I'm hoping that a few develeopers and myself might be able to pull off something new here.

First off, feel free to interupt me if you feel there is a better way of doing this, but this is what I'm sort or thinking in my head (might be a little cpu hungry).

THE PLAN:

Run a loop that will go through a series of pixel's, grabbing the pixel color, and storing it in an array. The min/max X and Y value's would have to be set before the loop.

After it grabs a section of the screen's pixels, it would wait/(or immediately?) run through the loop again, check if any of the pixel colors have changed.

Now, in the situation I intend to use the script for, there is SLIGHT color changes (lighting effects) occuring all the time. I'm pretty sure that you can have a color range though, so the color number of "Dark Dark Blue" would be closer to "Dark Blue" than lets say "Red" would... this leaves room to give the script some slack.

We could just do something like: if ($pixelColor - 1000) < $currentColor > ($pixelColor + 1000)

Excuse any improper syntax, its just to get the idea across...

ANYWAYS, that's just me brain storming.... I'd appreciate your thoughts, let me know if you think this would work, any changes you might suggest, etc...

Thanks

Edited by joncom
Posted

This would bring up the question of how to make sure that it takes into consideration slight lighting effects... using this function, a single pixel changing seems to complete alter the checksum value significantly....

I need the detection to pick up on significant movement... not slight...

Posted

This would bring up the question of how to make sure that it takes into consideration slight lighting effects... using this function, a single pixel changing seems to complete alter the checksum value significantly....

I need the detection to pick up on significant movement... not slight...

<{POST_SNAPBACK}>

working with security cam video?
[u]Do more with pre-existing apps![/u]ANYGUIv2.8
Posted

No, just detecting motion on screen... like if you took a window, and drags it in front of the motion area, it would detect the significant change.... but if the color of the area just changed slightly, it would notice the change, but be smart enough to just ignore it.

Posted

I played around with this one morning. It latches on to the pixel color and can track it.

It will search the last position fo the pixel color in a widening box until it finds it. The searching could be improved so it doesn't search the same area twice.

But it was interesting fooling around with it.

#68445

AutoIt3 online docs Use it... Know it... Live it...MSDN libraryglobal Help and SupportWindows: Just another pane in the glass.
Posted

Thanks, but I'm not looking for a single pixel, or even a pixel color... The pixelcolors that I store, and constantly changing slightly due to lighting effects in the game.

Have you ever seen a motion capture camera program... how you can set the sensitivity.. I need somethign sort of like that, how it can see that there is motion, and I can specify how intense the motion must be before it acts upon it.

Posted

you mean ur just making a auto-shooter???

then it will be of no use, because the pixel search is to slow :)

i tryed this allready for a insta-gib game, and it shoot 0.3 sec after seeing a person and that just to slow. (frikking bunny hoppers)

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Posted

3 sec?? then it'll be possible, but don't scan an area that big, because it will eat ya cpu.

where is is for anyway?

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Posted (edited)

I need the detection to pick up on significant movement... not slight...

PixelChecksum ( left, top, right, bottom [, step] )

When using a step value greater than 1 you must bear in mind that the checksumming becomes less reliable for small changes as not every pixel is checked.

Couldn't you just change the step value to a larger number?

Edited by Burrup

qq

Posted

I THINK THAT AIN;T GOOD

checking colours would be better, because you can set the shades there.

so it would be better with the Lights, he was talking about

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...
Posted

You'll want to use PixelGetColor and save some colors to variables and then figure out your thresh-hold for "motion" be it 100 shades ot 10000 shades of that color. It can be done pretty simple, just a bit CPU intensive.

I've done this a few times with odd results. The problem is, the built in pixel functions are really horrible (just lemme get ahold of the source code, grrrr).

Anyways, this might enlighten you on your goal:

;Change these to the area you want to search in PixelSearch format (top,left,right,bottom)
$left = 0
$right = 0
$top = 0
$bottom = 0

While 1
       ;Your loop here
        If Check_Motion() = 1 Then
               ;Do whatever on motion detected
        EndIf
WEnd

Func Check_Motion()
        $color = (put your initial color here)
        For $x = $left to $right
                For $y = $top to $bottom
                        $motion_color = PixelGetColor($x,$y)
                        If $motion_color > $color+1000 OR $motion_color < $color-1000 Then
                                $motion = 1
                                ExitLoop
                        Else
                                $motion = 0
                        EndIf
                Next
                If $motion = 1 Then ExitLoop
        Next
        Return $motion
EndFunc

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...