flat assembler
Message board for the users of flat assembler.
Index
> Windows > (faster) GetPixel alternative? |
Author |
|
r22 14 Mar 2006, 04:27
A better way would be to get a DIB array of the whole image and then scan the array. This way you are avoiding repeated API calls to a slow function such as GetPixel.
Here's a few links that will help you. -This one shows the process (not in assembly but easily portable). http://www.codeguru.com/cpp/g-m/gdi/article.php/c3693/ -MSDN articles on the subject. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_7gms.asp http://msdn.microsoft.com/library/default.asp?url=/library/en-us/gdi/bitmaps_87eb.asp |
|||
14 Mar 2006, 04:27 |
|
Reverend 14 Mar 2006, 16:26
I'm not sure if it would work for you, but maybe a good solution is to calculate some hash value (like crc32) from the correct rectangle (treat pixel by pixel just as buffer with some bytes) and do the same with the one you're looking for. Than you have to compare just one dword. Of course this solution isn't always perfectly correct, but for most cases is ok. At least theoretically
|
|||
14 Mar 2006, 16:26 |
|
Madis731 15 Mar 2006, 08:11
Hash is not the way to go with OCR or other image-recognition. You need to filter out the "definately-NO" situations as quickly as you can and compare you search with the image only incrementally.
Its like looking for a word "for" in this sentence. You don't compare "for" with every part of the sentence, but rather search for "f", then check if the next is "o" etc. and on every error you fall-back to "f". Anyhow the same goes for gamehacks etc. (sorry, I don't have a clue what you are doing). By searching for the first matching colour only then will you try to match it with the rest of you search-image. |
|||
15 Mar 2006, 08:11 |
|
Tomasz Grysztar 15 Mar 2006, 09:32
So maybe apply something like Boyer-Moore algorithm? Perhaps two-dimensional variant.
|
|||
15 Mar 2006, 09:32 |
|
RedGhost 18 Mar 2006, 02:55
Madis731 wrote:
apparently you do know what i'm doing thanks for the info guys (feel free to expand more on algorithms and etc) but i dont think crc or checksum would work as the coloured parts will be in completely different positions of the screen with a constant changing background as different parts of the 3d world are rendered _________________ redghost.ca |
|||
18 Mar 2006, 02:55 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.