Sign in to follow this  
Followers 0
Deviant

Need help with pixel color

9 posts in this topic

I'm looking to be able to find a color on the screen.

So far I have been able to locate the color. However the item I'm looking for sways side to side like a blade of grass.

The movement is minimal and I can locate the color with the searchPixel, but it moves enough that the getpixelcolor = colorblah. Isn't exact.

Is there a way to specify a range of colors on the getPixelColor, or is there another creative solution?

*puzzled*

Share this post


Link to post
Share on other sites



I'm looking to be able to find a color on the screen.

So far I have been able to locate the color.  However the item I'm looking for sways side to side like a blade of grass.

The movement is minimal and I can locate the color with the searchPixel, but it moves enough that the getpixelcolor = colorblah. Isn't exact.

Is there a way to specify a range of colors on the getPixelColor, or is there another creative solution?

*puzzled*

<{POST_SNAPBACK}>

Hrm. It actually sounds like the color you out put is probably the color you are looking for but a different shade (most game items or anything like that wont be a single color. It will be several that look to be one when put together).

I cant think of anything right off. I will look at the helpfile to see what I can come up with.

JS


AutoIt Links

File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out.

ComputerGetInfo UDF's Updated! 11-23-2006

External Links

Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more)

Share this post


Link to post
Share on other sites

Hrm. It actually sounds like the color you out put is probably the color you are looking for but a different shade (most game items or anything like that wont be a single color. It will be several that look to be one when put together).

I cant think of anything right off. I will look at the helpfile to see what I can come up with.

JS

<{POST_SNAPBACK}>

That's what I'm guessing.

It is a game item, and it's a variation of colors... ei, a blade of grass. It's all green, but each pixel is a different shade of green.

Like I said, I can locate it on the screen, but since it has a 5-10 pixel sway, it makes it very hard to hammer down the exact location, and to monitor when it is truely gone. ((not just swaying)).

I was thinking that it might be possible to use a pixel search of 0,0,200,200 to locate it, then do another pixel search based on the coordinates returned with a tighter shade tolerance and rectangle. (ponders)

Then if it would be possible to grab every color in a 10x10 pixel box, create an average. Then compare that average every few miliseconds for a drastic change.

I really don't know how to accomplish this, but I think the logic seems there.

*ponders*

Share this post


Link to post
Share on other sites

PixelSearch with variation

<{POST_SNAPBACK}>

I'm using pixel search to find it originally, however I'm not sure how to use it to monitor it. I need to monitor the cords real-time for a drastic change.

Since the item is swaying, pixel search may grab it on the far right sway then as it moves to the left, the color isn't green anymore.

I tried to offset the search by a few pixels and check there, but I was a problem with finding a like pixel.

I'll try to use pixel search for again.

Maybe I can do something like pixelsearch area, for color grean shade 10.

Then do another continual pixel search on a small area based on the returned values of the "pre-search" with a tighter pixel shade. Then react when it errors out?

Does that sound feasible?

How fast can the pixel search monitor a 10x10 grid?

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

I would like to give you specific help, but my answer will be as specific as your question. Are you monitoring for the "image" on the screen to disappear, move, remain still? What time frame are you considering? If the image does not move for 3 seconds? The moment the image is gone? Do you need coordinates to click on?

I will however start guessing what you need, and by Saturday we should be accomplished...

Lar.

<{POST_SNAPBACK}>

I'm monitoring the image for it jerk. The blade sways in the breeze, then when gets bumped, this is when I want to react. When it gets bumped, it will move to right for a few seconds then come back to the area where it was swaying, the movement is not very drastic, but enough that it's detectable. Also change happens pretty fast. If your not watching it closely, you can miss it and more importantly never tell it happened.

The interval that I'll be watching will be 30 seconds or so at a time, and the jerk can happen anywhere in that interval.

I have a series of steps after the detection that have to be complete, but yes I need the approximate cords of the image, but the moment of movement is more important.

I can handle the other items, it's just the detection of a multi shaded item that jerks then returns to the same location in under a second that I'm having a problem with.

Thanks for the help.

Edited by Deviant

Share this post


Link to post
Share on other sites

is there anything in the area where it gets "bumped" to that is the same color? I would monitor the area that it gets bumped to, rather than the area where it usually is. If it is a horizontal movement, then just do a single line PixelSearch...

$a = PixelSearch(200,200,300,200,0xFFDE23,20)

If Not @error Then FoundIt()

Lar.

<{POST_SNAPBACK}>

The area around the blade is a different green field that ripples with the wind also.

So it's not always the same color either. =/

I'm gonna try to use the pixelSearch within the pixelSearch. So see if I can narrow it down.

Share this post


Link to post
Share on other sites

While Not @error
 $grassCoord = PixelSearch( $grassArea1x, $grassArea1y, $grassArea2X, $grassArea2y, $grassColor, 5, 2 )
WEnd

Would something like this work? If I'm thinking right, it should loop til it errors out? I'll need to add a time counter to keep it from sitting here forever? But is this feasble, and will the syntax work?

Share this post


Link to post
Share on other sites

Is the @error global across the script or local to that routine?

Share this post


Link to post
Share on other sites

Many AutoIt functions set @error. And you can set it yourself with SetError().

<{POST_SNAPBACK}>

If I have something like.

Do

hello

Until @error

Can I follow that will a SetError() to set it back to nothing?

This is starting to get very spaghetti like. :)

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0