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

Bug v2.2:

Using FF UDF for a while for its awesome speed and noticed that every time it takes a screenshot it freezes the screen while it taking a screenshot. I understand that its only 50 ms or so but it introduces a screen stutter. VERY annoying in smooth applications. Please fix if possible...

Edited by dexto
Link to comment
Share on other sites

Hello,

changing that would be quite complicate : it means using multithreading, and asynchronous calls.

But the best way to fix this is to make the application that draw on the screen and the autoit script that calls the FF functions work on different threads. That is, usually two different applications or script running separately.

Does it make sense ?

Link to comment
Share on other sites

  • 2 weeks later...

Salut FastFrench, je suis tes travaux depuis déjà quelques petites années, et je m'en sers personnellement pour mes modestes créations.

Pour ma part, je suis passé de l'autoit au C# et j'apprécie ce langage et je me demandais si tu pouvais me conseiller à propos de l'utilisation de fastFind en C# car j'aimerais pouvoir optimiser au mieux son utilisation dans ce langage.

Je n'ai pour l'instant pas de question précise en tête, j'en aurais surement mais si tu avais ne serais-ce que quelques précieux conseilles, cela me serais très utile.

Je te remercie d'avance.

Cordialement.

English version:

Hi FastFrench, I'm following your works since a few years, and I'm using it for my humble program.

For my part, I switched to C# and I appreciate this language of programmation and I was wondering if you could advise me about using fastFind in C# because I'd like to optimize its use in this language.

I do not have any question for now but if you have any advise to give me, I will be very thankful.

Thank you in advance.

Best regards

Link to comment
Share on other sites

Hi lobidon,

you can indeed use the Fastfind dll within a C# project, but have first some wrapping to do. The point here is : how to use an Unmanaged dll into a .NET language. This is done like when we need to use Windows API functions in C#.

Here is a link to give you the idea:
http://stackoverflow.com/questions/12849104/creating-net-wrappers-for-windows-api-and-com-dlls

If someone write a somewhat complete wrapper, it would be nice to include it in the FastFind package.

Thanks,

FF

Link to comment
Share on other sites

  • 3 weeks later...

It's been a while since I've been back to check this thread, but I'm still using this library in almost every au3 project I do. Despite occasional bugs, it saves me so much work, and makes my scripts MUCH faster.

I've downloaded a copy of your source from github and will try making sense of it if I find the time and motivation. Thanks for your contribution, it's much appreciated!

Link to comment
Share on other sites

  • 1 month later...

Hi there, FastFrench.

I have a problem with the latest version of FastFind(ver 2.2 from github). It crashes immediately when function FFLocalizeChanges is used.

Instruction at address "0x7c919c0f" referenced memory at "0x0168001d". Memory cannot be "read". Addresses are always different ofc.

****************************** FastFind 2.2 (c)FastFrench 2013 ********
        Started  Fri May 02 13:58:09 2014

           487.492µS|ChangeMode(231) => m_bDebugGraphique=1, m_DebugModeTxt=  E3

****************************** FastFind 2.2 (c)FastFrench 2013 ********
        Started  Fri May 02 14:00:21 2014

           273.778µS|ChangeMode(231) => m_bDebugGraphique=1, m_DebugModeTxt=  E3

I am using windows XP SP3 at this machine. Version 2.0 has not this issue and I am using it currently. You library is really helpful and saved me a lot of coding time and processor power :idiot: Have a nice day.

Link to comment
Share on other sites

  • 4 weeks later...

@FastFrench

Hello friend, first congratulations for the excellent work, but the error mentioned by the member "holoc" also happens to me using Windows 7...

One question: "Any chance of saving the contents of the "FFSnapShot" directly into a variable?"

So long,

JS

http://forum.autoitbrasil.com/ (AutoIt v3 Brazil!!!)

Somewhere Out ThereJames Ingram

somewh10.png

dropbo10.pngDownload Dropbox - Simplify your life!
Your virtual HD wherever you go, anywhere!

Link to comment
Share on other sites

@FastFrench

Hello friend, first congratulations for the excellent work, but the error mentioned by the member "holoc" also happens to me using Windows 7...

One question: "Any chance of saving the contents of the "FFSnapShot" directly into a variable?"

So long,

JS

 

You can get the raw data of a snapshot using FFGetRawData ( [ NoSnapShot ]). 

From the manual: 

It returns a string stride with the Raw bytes of the SnapShot in 8 Hex digits (BGRA) of pixels from left to right, top to bottom ; every pixel can be accessed like this: StringMid($sStride, $pixelNo *8 +1 ,8) and you get for example 685E5B00 (blue = 68, green = 5E, red = 5B, alpha = 00).

However, I agree it would be nice to have an option for FFSnapShot to return a handle to a HBITMAP, similar to what the _ScreenCapture_Capture method does.

Link to comment
Share on other sites

I'm looking for a functionality that will search any pixel related to what I'm searching... For example, Red color may contain any digit code between 860516 to FF8999. So any color range between those digital, it will pinpoint it.

Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.")
Link to comment
Share on other sites

  • 3 months later...
  • 2 months later...

Hi, i`m try use this library 2 days and now i have this function if some need. This works like Standart Pixel Search and have some more greate update by FF.

Func _PixelSearch($Left, $Top, $Right, $Bottom, $Colors, $ShadeVariation = 0, $Step = 1, $hWnd = -1, $PixelsCount = 1, $AreaSize = 1, $PosX = -1, $PosY = -1)
    ;calculate Real Pos and Size
    Local $Temp
    If $Left > $Right Then
        $Temp = $Right
        $Right = $Left
        $Left = $Temp
        $PosX = $Left
    EndIf
    If $Top > $Bottom Then
        $Temp = $Bottom
        $Bottom = $Top
        $Top = $Temp
        $PosY = $Bottom
    EndIf

    ;check for Position
    If $PosX = -1 Then $PosX = $Right ;Int(($Right - $Left) / 2)
    If $PosY = -1 Then $PosY = $Top ;Int(($Bottom - $Top) / 2)
    If $PosX < 0 Then $PosX = 0
    If $PosY < 0 Then $PosY = 0
    ;check for Colors
    If IsArray($Colors) Then
        FFResetColors()
        For $i = 0 To UBound($Colors) -1
            FFAddColor($Colors[$i])
        Next
        $Colors = -1
    EndIf

    If $Left = 0 Then $Left = 1
    If $Top = 0 Then $Top = 1

    ;FFNearestSpot($SizeSearch, $NbPixel, $PosX, $PosY, $Color, $ShadeVariation=0, $ForceNewSnap=true, $Left=0, $Top=0, $Right=0, $Bottom=0, $NoSnapShot=$FFLastSnap, $WindowHandle=-1)
    If $hWnd = -1 Then
        ;FFAddExcludedArea()
        Local $result = FFNearestSpot($PixelsCount, $AreaSize, $PosX, $PosY, $Colors, $ShadeVariation, False, 0, 0, $Left + $Right, $Top + $Bottom, False,0)
        ;Local $result = DllCall($FFDllHandle, "int", "GenericColorSearch", "int", $PixelsCount, "int*", $AreaSize, "int*", $PosX, "int*",$PosY, "int", $Colors, "int", $ShadeVariation, "int", $FFLastSnap)
    Else
        ;FFAddExcludedArea($Left, $Top, $Right, $Bottom)
        Local $result = FFNearestSpot($PixelsCount, $AreaSize, $PosX, $PosY, $Colors, $ShadeVariation, False, $Left, $Top, $Right, $Bottom, False, $hWnd)
        ;Local $result = DllCall($FFDllHandle, "int", "GenericColorSearch", "int", $PixelsCount, "int*", $AreaSize, "int*", $PosX, "int*",$PosY, "int", $Colors, "int", $ShadeVariation, "int", $FFLastSnap)
        ;FFResetExcludedAreas()
    EndIf
    ;check for errors
    If Not IsArray($result) Then
        SetError(1)
        Return False
    Else
        Return $result
    EndIf

But, u need write before use somthing this^

$aWinPos = WinGetPos("")
$aWinSize = WinGetClientSize("")
$hWnd = WinGetHandle("")
$rEndX = $aWinSize[0]
$rEndY = $aWinSize[1]
FFSnapShot(0, 0, $rEndX, $rEndY, $FFDefaultSnapShot, $hWnd)
;and now u can use this function for this FFSnapShot
Local $Colors = [0xECECEC,0xCBCBCB]
_PixelSearch($rEndX - 10, $rEndY - 10, $rEndX - 160, $rEndY - 160, $Colors, 5, 1, $hWnd, 1, 2)
;or
_PixelSearch($rEndX - 10, $rEndY - 10, $rEndX - 160, $rEndY - 160, 0xCBCBCB, 5, 1, $hWnd, 1, 2) 

Who can help me for update this fuction for dllcall use and maybe crop SnapShot fist (i try ;FFAddExcludedArea($Left, $Top, $Right, $Bottom)) 

P.S.Strongly not kick me for my eng - I'm from Ukraine :)

Link to comment
Share on other sites

  • 1 month later...

Hello,

Can somebody give me a short example on search pixel pattern?

Like typing to calculator 687 and running the program finds them, and return me 687?

Thank you very much

You can't do that easily with FastFind. It's more about colors than patterns. You can sometimes recognize items with the density of pixels of some colors, but that's it. You should have a try on OCR like Tesserac :

Edited by FastFrench
Link to comment
Share on other sites

I'm looking for a functionality that will search any pixel related to what I'm searching... For example, Red color may contain any digit code between 860516 to FF8999. So any color range between those digital, it will pinpoint it.

I don't understand what is the gap beetween 860516 and FF8999

What you can do, it's to look for the color FF0000 (pure red) with a 'shade variation' of something of less than 0x7F. This will detect pixels that have a RR component bigger than the blue and green one.

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