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

Hi all
Even not being a complete newbie with autoit, I am masisvely lost with this AU3 ...
1° Is the CHM ok, beacuse I ma unable to open it. It opens but can't get text to be diplayed while selcting a function

2° Topic spoke about a .EXE that autogen code and help understaing, but didn't found it anywhere in any version

Edited by Ebola57
Link to comment
Share on other sites

  • Developers
5 minutes ago, Ebola57 said:

Hi all
Even not being a complete newbie with autoit, I am masisvely lost with this AU3 ...
1° Is the CHM ok, beacuse I ma unable to open it. It opens but can't get text to be diplayed while selcting a function

2° Topic spoke about a .EXE that autogen code and help understaing, but didn't found it anywhere in any version

3° The embeded demo file do aboslulety nothing 

Wondering what kind of miracle you are expecting to happen now.... In other words: All required  details are missing to be able to assist you!

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

  • Developers

Sure, this has been asked multiple times and likely it isn't a trusted helpful so  (from.memory) I think you need to right click the helpfile and change a setting there to allow it to display html pages.

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Link to comment
Share on other sites

This time wasn't teh security problem where you have to Unblock Security, it used it from a netwrok device and there's a trick to do with regedit
Copied it locally and it's fine. Now I can read carefully this helpfull
Thanks Jos

EDIT : Got it to work. It is indeed incredibely fast. Not only on the same Snapshot where the speed is insane, but even while in full HD screen. A must have

Edited by Ebola57
Link to comment
Share on other sites

  • 3 weeks later...

Hi, what is the most recommended way to use these functions in a C# program?

I am trying to use DllImport but I don't know what are the parameters of the functions I need to import.

Edited by TuTRyX
Link to comment
Share on other sites

  • 4 weeks later...

Is there a known bug where FFNearestSpot() does not work with an are restriction (Left, top, right bottom)? I cannot get it work. It works fine without the area restriction and when I save the snapshot to a .bmp file the snapshot also looks right and contains the red.

I am trying to search for a 1x1 red pixel with shade variation red in a snapshot that is about 5 pixels wide and 100 pixels long. Also changing the proximity position to 0,0 then instead does not yield any results.

 

Any ideas? Thanks in advance!

Link to comment
Share on other sites

  • 2 years later...
On 1/11/2021 at 8:31 PM, YoloPota said:

I don't know if there is alway someone here to help people.

I have a big problem since windows 10, all Chrome_windgetWin_1 windows got black screen when snapshot them, i don't know why. Or maybe i mistaken the problem but i got stuck in my search of solutions.

I alreay had this probleme in 2019 but none helped me.  here: https://www.autoitscript.com/forum/topic/126430-advanced-pixel-search-library/?do=findComment&comment=1415361

 

 

I got into the same problem and found this explanation:

Quote

 

Applications made with frameworks such as electron app, QT, WPF... will print black screen in response to GetDC or GetWindowDC.

The only way around it is to make sure the target application is visible and take a screenshot of desktop at the specific coordinates where the target application is at.

 

So I decided to download the source code of the dll and fix it.

1. Now the SnapShot function takes a screenshot of a desktop at the coordinates of the window set by FFSetWnd(). So if the window is overlapped it will be overlapped in the snapshot. If the window is minimized you will get an error. Without window handle the function captures the whole screen as it used to.

2. You can pass any number of coordinates to FFSnapShot(). In previous versions you had to write all four coords even if you needed to pass only Left or Left,Top. Now, if Top is omitted it will be 0. If Right or Bottom are omitted they will get a value of a window width, height.

3. The last version (year 2015) of C++ project of the author on GitHub is fully Unicode, so some changes were made to the UDF file.

4. New function (LoadFromFile) was also implemented by the author in the project. I added it to the UDF - FFLoadFromFile('file path' [, snapshot_num])

DLLs are embeded.

FastFind_2.3.rar

Link to comment
Share on other sites

  • 3 months later...

I am just going through this thread and plan on carefully reading the entirety of it.  But it's long and will require hours.  

 

In the meantime, I have what is likely a fairly simple problem that I'm just not getting.  I am trying recreate a native Autoit pixelsearch with FFnearestspot.  The pixel search $example = pixelsearch(500,500,560,500,0xaaaaaa,45).  This is a search rectangle that is 1 pixel high, 60 pixels long and searches for the first slightly off-white pixel that it encounters, with a fairly wide shade variation so that many different shades of off white will trigger it.  

I attempted to recreate this with $example2 = FFNearestSpot(2,1,500,500,0xaaaaaa,45,0,0,1,60,0), but it's simply failing across the board.  My help file won't display text, so I am using a help file I found online, but it lacks example code.  

 

Are there any suggestions on how best to replicate the original native Autoit search?  The reason I am looking to do this is time savings.  The native search takes around 20ms on a pretty beefy desktop.  And this results in prohibitive run times for the full program.  Thanks.  

Link to comment
Share on other sites

To emphasize, I need to exactly recreate the functionality of the native pixelsearch as described above, or I would have to rewrite the entire script from scratch.  If the Fast Find search returns a result that is even 1 pixel off 1% of the time, the entire script is worthless.  

Link to comment
Share on other sites

I tried reverting to a different version of the script, which was dramatically too slow due to using hundreds of iterative pixelgetcolor() calls.  I substituted ffgetpixel instead, which works with spectacular speed and would easily turn the script from trash into viability.  But ffgetpixel only returns 0xFFFFFF no matter the color of the underlying pixels.  What am I missing? 

Link to comment
Share on other sites

^^^I'm not sure exactly what that is.  But I have two versions of essentially the same program, both of which took weeks to write.  I am really looking for an exact substitute for either the native pixelsearch() or pixelgetcolor() that doesn't require a huge learning curve and that can provide speed increases of at least 10x.  Thanks.     

Link to comment
Share on other sites

I replicated the logic of FFgetpixel with what I can get to work of the FFNearestSpot function.  It is definitely running faster.  But only by a factor of about 4x, which is vastly slower than the .45ms (vs ≈20ms for pixelgetcolor), or over 40x faster speed I was getting with the ever-FFFFFF-returning FFgetpixel.  Any suggestions would be greatly appreciated.    

Link to comment
Share on other sites

The FFgetpixel function apparently wasn't working because I 1) lol misspelled it ffgetpixel() instead of FFgetpixel() and 2) it apparently requires FFsnapshot() to be run first.  Also, I discovered with FFnearestSpot() that the snapshot parameter must be set to zero on all subsequent calls in order to realize maximum speed gains.  There should only be one or the minimum required snapshots taken with FFgetpixel as well.   

Link to comment
Share on other sites

On 7/29/2011 at 12:17 PM, FastFrench said:

Also, i've done a mistake in my previous answer : first parameter should be 1, not 0 (a single pixel is a 1 pixel x 1 pixel square, not a 0x0 one).

 

 

$return = FFNearestSpot( 1, 1, 0, 0, 0x3D494D, 3, true, 368 , 321 , 373 , 327) 
If IsArray($return) = True Then 
; ... action

This exact code, with only the color changed to the exact color on my screen at (368,321) does not work, setting @error to 1.  I've tried multiple different coordinates, search areas, colors and distances.  It doesn't work.  

Link to comment
Share on other sites

Posted (edited)

After extensively tinkering, it looks like the code

FFsnapshot(500,500,560,501)

$testVariable = FFNearestSpot(1,1,500,500,0xaaaaaa,45,0)

roughly duplicates the native pixelsearch(500,500,560,500,0xaaaaa,45).  I haven't tested it yet extensively to see if it always returns the same results.  Another solution is to populate every possibly encountered shade variation that would otherwise be captured by the "45" shade variation parameter with

FFaddcolor(0xaaaaaa)
FFaddcolor(0xaaaaab)
FFaddcolor(0xaaaaac)
FFaddcolor(0xaaaaad)...


FFsnapshot(500,560,500,501)

$testVariable = FFNearestPixel(500,560,-1,0)

although this last method may obviously fall short where the target pixel can take on many different shades.  I also don't know if the apparent minimum 2-pixel wide search rectangle that FFNearestSpot and FFNearestPixel force you to use will always return exactly the same result as the 1-pixel-wide search line that is possible to use with the native pixel search.   

 

Edit:  The problem with doing this is that if you need to search multiple areas of the screen then FFsnapshot needs to be called every single time.  While faster, this is only about a 2x speed improvement over the native pixel search.  I've figured out a workaround, but it will take a lengthy although no where near complete rewrite of my program.  It would still be cool if anyone knows of a way to replicate the native Pixelsearch() while maintaining the 40x or so max speed increase that FFNearestSpot can deliver.  
 


 

Edited by UnitedStatesian
Link to comment
Share on other sites

  • 2 months later...

This will sound like a stupid question, but how and where do I install this. I tried putting all the files in the "Includes" folder, but when I try to include it in a script I receive a message saying "Failed to load FastFind.dll, application probably won't properly work. Check if the file Fastfind.dll is installed near this script."

Link to comment
Share on other sites

5 minutes ago, scifigeek64 said:

I tried putting all the files in the "Includes" folder

FastFind.dll should be in the same directory with your script.

When the words fail... music speaks.

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...