NumFound

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ca10c3sar
Newbie
Posts: 16
Joined: Thu Apr 13, 2017 7:36 pm

NumFound

Post by ca10c3sar » Wed Dec 20, 2017 8:23 pm

140491865.jpg

Code: Select all

//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_12.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>10
  MessageModal>NumFound
Endif
How to read the number of images found in "numfound of findimagepos"?

Trying do a script to when detect more than 10 "image_12"
obs: image_12 is that green life bar in first image
wt.png
But numfound only work with >0 and always give as answer in modalmessage "1"

User avatar
Marcus Tettmar
Site Admin
Posts: 7378
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: NumFound

Post by Marcus Tettmar » Thu Dec 21, 2017 8:25 pm

You are using CCOEFF. From the manual:
CCOEFF:Tolerence should be given a value between 0 and 1 where 1 is a precise match and 0 is the least precise. A value of 0.7 is recommended and should allow for subtle variations in the images and works best for portability. The lower the value the more likely false positives will be observed. With CCOEFF matching only one match (if any) is returned - the most likely candidate. CCOEFF will work with bitmap or png files.
Emphasis mine.

You have the manual with your installation. Hit F1. Or view the online version here:
https://www.mjtnet.com/manual/findimagepos.htm
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

ca10c3sar
Newbie
Posts: 16
Joined: Thu Apr 13, 2017 7:36 pm

Re: NumFound

Post by ca10c3sar » Thu Dec 21, 2017 10:41 pm

I already had read that CCOEFF info in faq, my doubt is how to return the numbers of match found and not only that one match were found.

If thats not possible in findimagepos, theres any other way?

Code: Select all

Let>x=0
ScreenCapture>431,109,932,608,%TEMP_DIR%\screenrect.bmp

FindImagePos>%BMP_DIR%\image_13.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound(%x%)
Let>x=x+1
FindImagePos>%BMP_DIR%\image_14.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound(%x%)
If>NumFound(%x%)>0
  MessageModal>NumFound

  Endif
Not possible use numfound with a variable? That script above fail

ca10c3sar
Newbie
Posts: 16
Joined: Thu Apr 13, 2017 7:36 pm

Re: NumFound

Post by ca10c3sar » Sat Dec 23, 2017 6:12 am

So if i have a area to capture and want search like 10 images in that area, i cant use this code:

Code: Select all

ScreenCapture>427,133,1501,896,%TEMP_DIR%\screenrect.bmp
FindImagePos>%BMP_DIR%\image_13.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound
FindImagePos>%BMP_DIR%\image_14.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound
FindImagePos>%BMP_DIR%\image_15.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound
FindImagePos>%BMP_DIR%\image_16.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound
FindImagePos>%BMP_DIR%\image_17.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound
FindImagePos>%BMP_DIR%\image_18.bmp,%TEMP_DIR%\screenrect.bmp,0.7,1,XArr,YArr,NumFound
If>NumFound>0
  MessageModal>NumFound

  Endif
Because if the last findimagepos doesnt find anything but those before find, it still will fail bc last numfound is 0, how can i do when searching multiple image in a same image?
If i want search 10 image in same area ill need do 10 findimagepos complet script?

User avatar
Djek
Pro Scripter
Posts: 147
Joined: Sat Feb 05, 2005 11:35 pm
Location: Holland
Contact:

Re: NumFound

Post by Djek » Sat Dec 23, 2017 8:18 am

when i read your problem, thought it was easy,

i created a source bmp with needle bmp and made a script example.
http://www.djekdata.nl/macrosched/bron.bmp

http://www.djekdata.nl/macrosched/rood.bmp

But that didnt work. I managed to find 1 circle, but the next i can not detect.
I am puzzeled..... :shock:

Perhaps someone else could create a working example?

kind regards,
Djek

ca10c3sar
Newbie
Posts: 16
Joined: Thu Apr 13, 2017 7:36 pm

Re: NumFound

Post by ca10c3sar » Wed Dec 27, 2017 3:44 pm

Code: Select all

CODEBLOCK

ScreenCapture>427,133,1501,896,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp
//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_132.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_133.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_134.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_135.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_136.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_137.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_138.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_139.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif




//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_140.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_141.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_142.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_143.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_144.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif





//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_145.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif




//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_146.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_147.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif




//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_148.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif




//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_149.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_150.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_151.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif




//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_152.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif



//Find and Left Click Center of 
FindImagePos>%BMP_DIR%\image_153.bmp,C:\Users\CAIO\Documents\Macro Scheduler 14\Up - Logout\dir.bmp,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0

    Let>XP={%XArr_0%+427}
    Let>YP={%YArr_0%+133}
    Goto>Direção
    
Endif


ENDCODEBLOCK
Those images are different and i cant reduce the search area, someone else could help? its 11 seconds to scan all images and use abut 10%cpu :|

Any idea to make scan faster and cpulower?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts