Jump to content

Image Search Library


kangkeng
 Share

Recommended Posts

  • 4 weeks later...
  • 4 weeks later...

Some of the images I'm trying to find within another program are rendered at runtime, and the hue of some of the pixels changes slightly. I'm not really sure why. Can I still make this plugin work, somehow? I've tried adjusting the tolerance setting, with no luck. Once I get it high enough, it just matches odd places in the program. Has anyone dealt with anything like this? Any tips, or other algorithms that might work better?

Link to comment
Share on other sites

  • 1 month later...
  • 5 weeks later...
  • 4 weeks later...
  • 1 month later...

Hi,

I hope this is still active, anyway, the dll and au3 is working fine. (I'm using windows 7 32-bit) but if the image that I want to check is in the window (third party application), the library couldn't find the image. I honestly have no idea how the library and au3 works but is there a way to fix that problem? This is the same problem that I encounter with ALL of the tools that I used.

I also experienced the same problem with Screen Capture Library before. For some reasons, (which I dont know) it doesnt capture the window of the third party application that is currently open in the desktop. but someone found a way to fix it. Here's the link maybe this could help you modify the library.

I hope you understand my question, Im not really good at this.. explaining. :(

Thank you!

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

im still getting the line 40 error -_- anyone founded the issue to fix it?

here is my script

#include <ImageSearch.au3>

$x=0

$y=0

while 1

Sleep(5000)

$Search = _ImageSearch('ImageTest.Bmp', 0, $X, $Y, 0)

if $search = 1 Then

mousemove($X, $Y, 10)

sleep(500)

EndIf

WEnd

Link to comment
Share on other sites

Where did you put the dll file? From looking at the script it uses a relative path to the dll file, so I'm guessing it needs to be in the script folder or the working dir if you've changed 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

  • 2 months later...

Try reading through the thread, from reading the thread this question has been asked many times. There are alternate download links in this thread.

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

True, answered so many times that I cant find an ABSOLUTE final working version (ppl should put version numbers on the filenames. "imagesearch-5.0.rar" for example)

Can someone point me out to a final version of this?

Im currently working with the "non transparency" version (thats great btw) but I could really use the added functions.

PD: Googling already done, 1st link site:autoitscript.com imagesearch autoit transparency

Link to comment
Share on other sites

I'm trying to get this to work, and failing terribly!

I'm trying to detect when the mousecursor changes to something I am interested in.

Local $xr = 0
Local $yr = 0

For $i=1 To 600
Local $mpos = MouseGetPos()
Local $fnd = _ImageSearchArea("fish.png", 1, $mpos[0]-5, $mpos[1]-5, $mpos[0]+50, $mpos[1]+50, $xr, $yr, 200, 0x000000)
_ScreenCapture_Capture("R:\Capture-"&$i&"-r"&$fnd&".png", $mpos[0]-5, $mpos[1]-5, $mpos[0]+50, $mpos[1]+50)
sleep(50)
Next

So I take a snapshot everytime I do a comparison, but the result from _ImageSearchArea() is always 0.

The 3 attached images are my comparison file, and two consecutive dumps of the area around the cursor.

If I load my fish.png into an image editor, strip out the solid black, and paste it into the matching grab, I can see its the same size and the pixels match perfectly.

Can anyone help ?

Posted ImagePosted ImagePosted Image

Link to comment
Share on other sites

  • 3 weeks later...

hey real quick question, i have looked over all the post and it is not clear. I am on windows 7 64 bit. i have downloaded many of the dills but nothing is working. i have one that was 64 and have tried a 32 bit however it is hard to pin down where the problem is. i have even removed the need for the au3 include, however when i run it i get

$result[0]="0" then return 0

if $result^ ERROR

so with that, anyone that has this working on a 64 bit OS i would love a simple clip of code you used and the dill if your willing i have tryed many thign but i am going to link my last try at getting it working.

$findImage = "Untitled.bmp"
$resultPosition = 1
$tolerance = 255
$x = 0
$y = 0
_ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance)

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance,$HBMP=0)
MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
If IsString($findImage) Then
$result = DllCall(@ScriptDir & "\ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP)
Else
$result = DllCall(@ScriptDir & "\ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"ptr",$findImage,"ptr",$HBMP)
EndIf; If error exit
    if $result[0]="0" then return 0
; Otherwise get the x,y location of the match and the size of the image to
; compute the centre of search
$array = StringSplit($result[0],"|")   $x=Int(Number($array[2]))
   $y=Int(Number($array[3]))
   if $resultPosition=1 then
      $x=$x + Int(Number($array[4])/2)
      $y=$y + Int(Number($array[5])/2)
   endif
   return 1
EndFunc

the DLL is in root dir

Link to comment
Share on other sites

  • 3 weeks later...

hey real quick question, i have looked over all the post and it is not clear. I am on windows 7 64 bit. i have downloaded many of the dills but nothing is working. i have one that was 64 and have tried a 32 bit however it is hard to pin down where the problem is. i have even removed the need for the au3 include, however when i run it i get

$result[0]="0" then return 0

if $result^ ERROR

so with that, anyone that has this working on a 64 bit OS i would love a simple clip of code you used and the dill if your willing i have tryed many thign but i am going to link my last try at getting it working.

$findImage = "Untitled.bmp"
$resultPosition = 1
$tolerance = 255
$x = 0
$y = 0
_ImageSearchArea($findImage,$resultPosition,0,0,@DesktopWidth,@DesktopHeight,$x,$y,$tolerance)

Func _ImageSearchArea($findImage,$resultPosition,$x1,$y1,$right,$bottom,ByRef $x, ByRef $y, $tolerance,$HBMP=0)
MsgBox(0,"asd","" & $x1 & " " & $y1 & " " & $right & " " & $bottom)
if $tolerance>0 then $findImage = "*" & $tolerance & " " & $findImage
If IsString($findImage) Then
$result = DllCall(@ScriptDir & "\ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"str",$findImage,"ptr",$HBMP)
Else
$result = DllCall(@ScriptDir & "\ImageSearchDLL.dll","str","ImageSearch","int",$x1,"int",$y1,"int",$right,"int",$bottom,"ptr",$findImage,"ptr",$HBMP)
EndIf; If error exit
if $result[0]="0" then return 0
; Otherwise get the x,y location of the match and the size of the image to
; compute the centre of search
$array = StringSplit($result[0],"|") $x=Int(Number($array[2]))
$y=Int(Number($array[3]))
if $resultPosition=1 then
     $x=$x + Int(Number($array[4])/2)
     $y=$y + Int(Number($array[5])/2)
endif
return 1
EndFunc

the DLL is in root dir

this could be an alternative fully in AutoIt just updated on W7 64 bits examples

Link to comment
Share on other sites

  • 2 months later...
  • Jos locked this topic
Guest
This topic is now closed to further replies.
 Share

  • Recently Browsing   0 members

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