Jump to content

Advanced Pixel Search Library


FastFrench
 Share

What do you think of this library ?  

35 members have voted

  1. 1. What do you think about FastFind ?

    • It's really great, I can't imagine doing a script without it
    • It's of some use for me in my current scripts
    • I could use it some day
    • Looks nice, but of no use for me
    • I've tried it, but it doesnt fit my needs
    • Sounds good on the paper, but can't make it work (bug or too difficult to use it)
  2. 2. Have you tried it ?

    • Yes, I'm using it right now
    • Somewhat, I've done some testing, will surely use it later
    • I've downloaded it and just played a little with packaged demo scripts
    • I've downloaded it, but not tried it so far
    • Not downloaded it so far, but I probably will some day
    • It's of no interested for me.
  3. 3. What is missing or should be improved ?

    • It has all the features I may need about Pixels Handling
    • OK it's pretty fast, but couldn't it be faster ?
    • Too hard to use it, could you simplify usage ?
    • Some additional features would be nice to have (please explain in a message)
    • It really lacks some decent documentation (I still hope to find someone to help on that)
    • Some critical features are missing, can't use it (please explain in a message)
    • I found some minor bugs (please explain in a message)
    • I've found some serious bugs (please explain in a message)
    • I've never tried it so far, can't tell
    • It would be nice if you could provide easy access to the associated tool - FFShowPixel
    • I would like to use it other languages. Could you provide wrappers ? (please explain in a message)


Recommended Posts

I found this library my coincidence since I don't use AutoIt, but must say it's really great, thank you very much or the effort youøve put into this.

I use it with C#, and noticed someone else was asking how to do it. It is fairly easy to wrap the dll using pinvoke like this:

using System.Runtime.InteropServices;

[DllImport("FastFind.dll")]
public static extern void SetHWnd(IntPtr NewWindowHandle, bool bClientArea);

I also have a few suggestions for additional features, which I would find useful, in (my ;)) prioritized order:

1)

Being able to search non-quadratic areas. Ie. to search for a 10 by 20 square, still using the same search options as normal.

2)

Additional debug tools:

-Another filter option, which will set all pixels that do not match a color (or color list and shade), to black (or even to a color you specify, in case you are looking for black), This would be useful in debugging, as I could see exactly which pixels is searched for.

-Being able to draw the regions found on snapshots, similar to how live debug works. also in general being able to easily draw a square on a snapshot, which I can then save to file would be useful.

3)

Even more advanced search: Being able to specify regions within the search rect, that should all match. Ie. search for a 10x10 rect, where the upper half has a min of 10 white pixels, and lower left corner min 10 red pixels.

Also, by any chance is this project open source? I have tried searching for it, but didn't find anything. I wouldn't mind contributing whenever I have some spare time.

Link to comment
Share on other sites

Hello,

I tried to use your programm: FFShowPixel 1.7

I use it like it is told in "About" section, but I couldn't see anything in window in left side.

Could You give me more detailed instruction how to use your tool?

Thank You in advance.

Posted Image

Link to comment
Share on other sites

@rarmig : glad to see another C# coders using FastFind.dll.

1/ If more people are needing this, I may add this feature. Complexity : medium.

2/ a) I'm not sure to understand. I guess you can already do that with Fastfind, don't you ?

;) why don't you draw your square or whatever and then do another SnapShot ? Adding graphical primitives to draw on SnapShots would be endless I fear (Squares, then rectangles, then textes, then filling textures, playing with colors...)

3/ I was thinking to a kind of pattern matching mecanism. But couldn't find an way to make it easy to use. And if it's not easy enough, it won't be used.

ienthach : you mean importing Bitmaps into snapshots ? Maybe I'll add this feature, it may be useful. What usage do you have in mind ?

frg : have you tried the function keys as stated in the "About..." ?

Link to comment
Share on other sites

Thanks for the quick reply.

1) I hope someone else would need this to, it is definitely a feature I miss often.

2) I might have overlooked how to do it. ApplyFilterOnSnapShot with 0xff0000 will keep all the read of all pixels, not just the ones with the exact color 0xff0000. ie 0xffffff and 0xff4242 would both become 0xff0000. For debugging it would be useful to have a filter that will keep only the pixels that match exactly 0xff0000, so I can see graphically which pixels of a snapshot it considerd. Again I might have missed it, if it is already possible it would be great?

3) It's true, that if its complicated to use, it would not be used. One possible way could be to do it similar to color lists:

void AddSearchRect(left, top, right, bottom, count, color) - where the coordinates is relative to the point one want to return.

Then if someone would search for the france flag, it would be something like:

AddSearchRect(-15, -10, -5, 10, count, 0x0000ff);

AddSearchRect(-5, -10, 5, 10, count, 0xffffff);

AddSearchRect(5, -10, 15, 10, count, 0xff0000);

Search(&X, &Y)

The found X,Y would then be in the middle of the white stripe.

But it might be to complicated to see actual usage.

Thanks again for a great library

Link to comment
Share on other sites

Another useful feature would be some kind of image search, finding a region that matches a image pixel for pixel.

One way it could be done, is to allow loading a image file into a snapshot, and then search an existing snapshot, for a region that match pixel for pixel.

ie. something like ImageSearch(snapshotToSearch, snapshotToFind, minCountToMatch, shadevariation), where minCountToMatch is the minimum number of pixels that must match for the region to be "found".

Link to comment
Share on other sites

Is this a bug? FFColorCount is returning more pixels than exist in the snapshot.

#include "FastFind.au3"

$Color = 0xD3B666
$Left = 1377
$Top = 918
$Width = 10
$Height = 144
$Right = $Left + $Width
$Bottom = $Top + $Height

$TotalPixels = $Width * $Height

FFSnapshot($Left, $Top, $Right, $Bottom)

$Pixels = FFColorCount($Color, 255, False)
ConsoleWrite($Pixels & "/" & $TotalPixels & "=" & $Pixels/$TotalPixels & @CRLF)
1595/1440=1.10763888888889
Link to comment
Share on other sites

I wanto auto click on my game, i have img1.bmp and search in img2 or a sreeen capture windows. then click on.

Thanks and wait for your new feature, love it.

We don't support game botting on this forum, so it's unlikely you'll get any help with that.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

FFSnapShot(0, 0, 600, 420)

I've noticed that FFSnapShot seems to get a division by zero error and crashes when specifying limits to it's search size. It takes about 10,000 iterations for it to happen, so I'm guessing it's a legit division by zero error when it gets zero as the random seed number for something in the functions?

Produces this after about 10,000 iterations on average. Mine is on a delay and only runs a hundred times or so per minute, so that may effect something.

Link to comment
Share on other sites

Memory usage never budges. These calls are not simultaneous, the memory is freed well before it becomes a problem. And 10,000 is an average. I have had it crash after a few dozen. I've also had it last well over 100,000 iterations. It's not a reliable amount of runs, it's random.

Do you actually use any division in the library for the FFSnapShot function? I don't see any in the au3 script, but that's only part of the feature(I think).

Edit:

And I forgot to stress that if I use FFSnapShot(0, 0, 0, 0) it never gets a division by zero error even with a million plus iterations. Only by adding limits does it occur. Obviously the full screen uses more memory than just a small section.

Edited by MystikSpiral
Link to comment
Share on other sites

Hi,

first off - great library your build there. I try to implement it in some of my scripts but i kinda hanging on some parts.

1. Is there a way to save the bitmap of the result of FFKeepChanges ? The Documentation regarding FFSaveBMP is kind of thin when i comes to the point which Slot it uses to create the cmp ( i guess its the default one )

2. I tryed to invoke a DllCall to FindBestSpot. The Problem is that the DllCall always returns 0. Can somebody post a snippet for a working DllCall on FFFindBestSpot with all parameters please ?

Featurerequest: :D

1. modify FFKeepChanges so it takes 3 Parameters: 1. Original Snapshot, 2 Compare Snapshot, 3. Resultsnapshot slot

The idea behind is that the result of FFKeepChanges only changes the same dots to black in the Resultsnapshot.

This way it would be possible to compare more than 1 State of an image.

Keep up the good work ! Thank you :huh:

Link to comment
Share on other sites

I've checked the C++ source code : there's no (explicit) division during SnapShots.

It may be in video drivers, or in Win API. It would be interesting to do the same testing on a completely different PC (other Windows Version + other screen resolution and graphic card).

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...