Sign in to follow this  
Followers 0
1905russell

Finding a unique color?

12 posts in this topic

In order to find a unique color in a rectangle would I first need to PixelGetColor the entire rectangle into an array and then count each color occurrence to find the minimum count? Is this the fastest method or is there a quicker way of doing this? What function would I use to count - StringInStr? I would really appreciate guidance and a concept script, if possible. If determining the unique color was easy and fast, it should make Larrys PixelAreaFind() even quicker to find a bitmap picture, I think.

Share this post


Link to post
Share on other sites



In order to find a unique color in a rectangle would I first need to PixelGetColor the entire rectangle into an array and then count each color occurrence to find the minimum count? Is this the fastest method or is there a quicker way of doing this? What function would I use to count - StringInStr? I would really appreciate guidance and a concept script, if possible. If determining the unique color was easy and fast, it should make Larrys PixelAreaFind() even quicker to find a bitmap picture, I think.

Are you trying to make an OCR?

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

Are you trying to make an OCR?

No - in order for Larry's PixelAreaFind() to work faster it helps to have a unique color for the PixelSearch. I just wanted to somehow predetermine that color instead of physically capturing it with his PixelAreaRecord(). Theoretically its something like min(countcolor(rect)) but I guess it's not worth it. If I had to search for a picture, then for speed I would need a unique pixelcolor (and surroundings) or else have to pick the centre pixel or pick a random pixel (and surroundings) and it would slow things down if I chose max(countcolor(rect))? Does it make sense to count each occurance while scaning the rectangle with PixelGetColor or map and wait until after the scan to do the count? Or is this just a good idea in theory but practically a bad one. Are there alternatives to calculating a unique color in a rectangle for a PixelSearch? Edited by 1905russell

Share this post


Link to post
Share on other sites

Are you trying to make an OCR?

If I would have said yes would you still ignore me?

Anyway I see there is a _ArrayMin() function and some array sorting functions. Did not see a value counting function but I guess I can figure out something.

Share this post


Link to post
Share on other sites

If I would have said yes would you still ignore me?

Anyway I see there is a _ArrayMin() function and some array sorting functions. Did not see a value counting function but I guess I can figure out something.

1. I don't remember me ever "having" to pay attention to anyone.

2. Larrys function is the fastest option you have for recognizing the "1st" pixel, then you'll need to modify it from there.

3. I seriously doubt after reading your statement that I would help if I had spent any time thinking of a better way.


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

1. I don't remember me ever "having" to pay attention to anyone.

2. Larrys function is the fastest option you have for recognizing the "1st" pixel, then you'll need to modify it from there.

3. I seriously doubt after reading your statement that I would help if I had spent any time thinking of a better way.

You dont have to pay attention to me but I am happy when you do. I need guidance and you are the best. On another thread you advised to find a unique color for Larrys function and I could not think of a more unique color than the color least used. For you to script and test this with Larrys function would take you ten minutes or less. For me it would take a week maybe because as you know this is all very new to me. For you to put together a couple of loops to array a rectangle filled with PixelGetColor() is just the simplest thing and would be a work of art. Also not sure how _ArrayMin() handles more than one color totaling the minimum?

Share this post


Link to post
Share on other sites

You dont have to pay attention to me but I am happy when you do. I need guidance and you are the best. On another thread you advised to find a unique color for Larrys function and I could not think of a more unique color than the color least used. For you to script and test this with Larrys function would take you ten minutes or less. For me it would take a week maybe because as you know this is all very new to me. For you to put together a couple of loops to array a rectangle filled with PixelGetColor() is just the simplest thing and would be a work of art. Also not sure how _ArrayMin() handles more than one color totaling the minimum?

No idea what you mean there. I also only participate in things that intrigue me, something I feel that will make me grow in an area. A week? That's good, when I first started with pixel functions, I never played with anything else for a month.

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

No idea what you mean there. I also only participate in things that intrigue me, something I feel that will make me grow in an area. A week? That's good, when I first started with pixel functions, I never played with anything else for a month.

Why would this not intrique you? You started with this 'unique color' thing. Cause you've been there, done that? Then share please. In the past, I figured out most pixel functions necessary to understand Larry's function. It took me a long time, no matter, I will never ever get to your level. All I really want is to macro easily. I would need to spend an uninterrupted week learning about array functions and indexes and searches. Figure out how to create and then loop this array with PixelGetColor. Thats a week right? Or use your example to show me how its all done and Ill go through it line by line until I understand it completely.

Also not sure how _ArrayMin() handles more than one color totaling the minimum?

Lets say both grey and purple where displayed 2 times and that was also the minimum occurrence of any color. I am not sure what ArrayMin() returns at this point - grey, purple or both? Pretty please, just a couple of easy loops?

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

It's not that it "might" not intrigue me, it's that the way you've asked the question doesn't. I seriously have no idea what you are trying to do or why.

Without code of your own commented on what you'd like to see done and where, a diagram of the steps your taking or think you shold take, the output you desire, and anything else that can attributed to successful request for help, I'm afraid you and I will only be having conversations on why it is that you are getting no help.

Edit:

I should add, that If you've noticed, I don't answer many threads any longer without seeing that others have at least attempted something... I can't stand a hidden agenda, you want help, tell us the program so we can see it, and try to decipher it ourselves. There's another member DuncanM that is playing the cloak and dagger game as well. Gets old after a while.

Edited by SmOke_N

[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

Not sure what you are talking about. Ive no secret agenda. The thread where you advised unique color had some person saying they tried to use Larrys function but they could not figure out how to match a picture of a coin. However they said another program AutoHotKey could do it. They said Larrys function was 1 million times not what they wanted. I felt bad. I know QuickMacros also has a bmp parameter in its PixelSearch. So if I took that coin is in a rectangle - I can calculate a unique color and PixelCheckSum the surroundings then use Larrys function to find the match. Thats it. So the next time someone asks this question they wont run back to AutoHotKey etc. This method should work until PixelSearch gets its bmp parameter. I swear I dont have a hidden agenda. Im an accountant who loves to macro, not a computer programmer.

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Never mind I'll figure this out.

Edited by 1905russell

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

Never mind I'll figure this out.

I figured it out.

The answer is - there is no 1 unique color shade as generally many shades only appear once.

Maybe the color used 200 times is unique in that it was the only color to be used 200 times?

Edited by 1905russell

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