Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Scan cant find image
#1
Im having problem with scan again....
One image it can find while it can't find the other image...
"Txt_CannotGainAtCurrentState.bmp" can be found.
"Txt_ClickOnCharToUseSkill.bmp" can not be found.

FYI: Im using the transparancy option also.
My own code to test it was:
Code:
Copy      Help
;Setup Search area for Image Recognition.
Application.IR.Search.left        = 0
Application.IR.Search.top        = 100
Application.IR.Search.right        = 220
Application.IR.Search.bottom    = 280
Application.IR.Txt_ClickOnCharToUseSkill.r = Application.IR.Search
if( FindImage(Application.IR.Txt_ClickOnCharToUseSkill, 0, 1, 1, 1) )
,bee
;;end-if
Application.IR.Txt_CannotGainAtCurrentState.r = Application.IR.Search
if( FindImage(Application.IR.Txt_CannotGainAtCurrentState, 0, 1, 1, 1) )
,bee; wait 0.5; bee
;;end-if


Attached Files
.zip   BmpImages.zip (Size: 1.2 KB / Downloads: 321)
Well thats all for now, 3M
#2
Try to not use RECT. If you use it to retrieve coordinates, make sure all its members are 0 before each scan call.
#3
I tried to set all coordinates to zero, because i had a long coding session yesterday, but it still cant find it.
Im using QM 2.1.8.8 atm...

I think maybe it has todo with the color in the bmp that QM's find has some problem with...?
Im realy puzzled why it cant find one but can find the other one...
FYI: The color of the texts on screen does not change.

PS: Not using RECT in my function is not an option because im using it to find graphical buttons and items with it also.
Well thats all for now, 3M
#4
Just to ease your mind here is my function:
Code:
Copy      Help
;*******************************************
;,FindImage v1.0
;*******************************************
;This is a macro to find images in screen.
;*******************************************

function# tIR&IR [int'bWait] [int'bCenterMouse] [int'bTransparent] [int'bDebug]
int bFound, iScanFlags
POINT-- pCurMousePos

iScanFlags = 16
if(bCenterMouse)
,iScanFlags | 1
if(bTransparent)
,iScanFlags | 4
;Fill rectangle with search area.
IR.r = Application.IR.Search

;Save curpos
xm(pCurMousePos, Application.sClientWindowClass, 1)
;Move mouse at skill buton "S", to not obstruct IR
mou 432 576 Application.sClientWindowClass 1
;wait Application.dMousePosDelay
;Find the image

err-
if(bWait)
,bFound = wait(Application.IR.dTimeout, S, IR.filename, Application.sClientWindowClass, IR.r, iScanFlags)
else
,bFound = scan(IR.filename, Application.sClientWindowClass, IR.r, iScanFlags)
err+
,;end _error 1

if(!bCenterMouse)
,;Move mouse back to saved pos
,mou pCurMousePos.x pCurMousePos.y Application.sClientWindowClass 1
,wait Application.dMousePosDelay

if(bDebug)
,out "Search: left=%i, top=%i, right=%i, bottom=%i", Application.IR.Search.left, Application.IR.Search.top, Application.IR.Search.right, Application.IR.Search.bottom
,out "Button: file=''%s'', left=%i, top=%i, right=%i, bottom=%i", IR.filename IR.r.left, IR.r.top, IR.r.right, IR.r.bottom
,out "Found: %i", bFound

ret bFound
Well thats all for now, 3M
#5
If its text you're trying to match, try turning off font smoothing.
Matt B
#6
I have captured it from the game screen in same state...
Anyway there seems tobe something fishy going on.
And im thinking its not QM's fault in this case after all...
Cause when i tried the same code on a window with the image of the bmp file it could be found...

I had a long day coding yesterday, maybe i overlooked something...
Anyway back to the drawingboard to debug this problem.
I think it has something todo with the color in the bmp and the game screen...
Well thats all for now, 3M
#7
Ok found it finaly....
Sorry Gintaras for this time...

Seems like i forgot to cut out one pixel that needed tobe transparent also...
Well thats all for now, 3M


Forum Jump:


Users browsing this thread: 1 Guest(s)