Jump to content

what is the best format to find with imagesearch


Recommended Posts

Hello,

I searched a format comparative for imagesearch.

But i didn't find.

I wrote a simple test for comparated.

My images created with paint. The size was 30 x 30. My resolution was 1600 x 900. My processor is core i3.

2 mains groups appeared:

With the sames colours : BMP, PNG

With the colours close : JPG, GIF, PNG with alpha colour (I used gimp for alpha colour)

My measured times:

The same colours with tolerance 0 = 60 ms

The colours close with tolerance 0 = 60 ms but I didn't find the image

The colours close with tolerance 80 = 120 ms but I didn't find the image

The colours close with tolerance 100 = 150 ms

The colours close with tolerance 120 = 200 ms

The colours close with tolerance 150 = 700 ms

The colours close with tolerance 160 = 1200 ms !!!

The colours close with tolerance > 160, the time decrease because find bad area on screen 

In conclusing, I would say that the problem is the tolerance. The tolerance impact the speed of search.

It is clear than formats change the quality are not as well as formats with the good quality.

Obviously, the image should be the same that final screen (same theme, same transparence effect, ....).

my test code:

#include <Date.au3>
#include "ImageSearch.au3"
#include <GUIConstantsEx.au3>

Opt("GUIOnEventMode", 1)  ; Passe en mode événement
$mainwindow = GUICreate("test", 200, 100)
GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")
GUICtrlCreateLabel("Test", 30, 10)
$okbutton = GUICtrlCreateButton("Test", 70, 50, 60)
GUICtrlSetOnEvent($okbutton, "TestButton")
GUISetState(@SW_SHOW)

While 1
  Sleep(1000)  ; Boucle de d'attente
WEnd

Func TestButton()
    Local $y = 0, $x = 0
    $nStartTime = _TimerStart();TimerInit()
        $nTolerance = 0
    Local $search = _ImageSearch('img/chrome.bmp', 1, $x, $y, $nTolerance)
    ConsoleWrite("Find :" & $search & " Duration : " &  _TimerCheck($nStartTime) & @CRLF)
EndFunc

Func _TimerStart()
    Local $atGT = DllCall("Winmm.dll", "dword", "timeGetTime")
    If IsArray($atGT) Then Return $atGT[0]
    Return 0
EndFunc

Func _TimerCheck($nTime)
    Return _TimerStart() - $nTime
EndFunc

Func CLOSEClicked()
  ; Note : Ici @GUI_CTRLID est égal à $GUI_EVENT_CLOSE,
  ; et @GUI_WINHANDLE est égal à $mainwindow
  Exit
EndFunc

Edit 1: I tested with image's size different, the time is the same until 200 x 200 pixels. After, more image is big, more time may be long;

Edit 2: I tested the transparency with option "*TransBlack" and "*TransWhite" (with png format). The time is too long (2000ms with tolerace equals 30, a tolerance lower without results)

Edited by sisko59

sorry for my english.

 

Link to comment
Share on other sites

  • Moderators

What most people find with imagesearch (much like MouseMove and MouseClick) is, due to the inherent limitations, there are usually better ways of doing things. I believe you'll find in short order that when it comes to imagesearch the question is, "what am I trying to accomplish, and why would I not use <method x> which is more reliable?" rather than "how can I ensure imagesearch is more accurate?".

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

Link to comment
Share on other sites

Hello JLogan3o13, I use imagesearch to valid software (i am functional consultant).

The software is writting in java. I use mouseclick, controlsend, _GUICtrlListView_GetItemText, ...

However, some buttons are generate with random instance and without name, title, text,..

sorry for my english.

 

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