Increase image detection

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ruanseb
Newbie
Posts: 5
Joined: Fri Dec 01, 2017 9:37 pm

Increase image detection

Post by ruanseb » Tue Dec 12, 2017 5:38 pm

How i can increase the chance to detect a image with different backgrounds, sometimes it changes her size too depending on the zoom

My actually script:

Code: Select all

//Find 
FindImagePos>%BMP_DIR%\image_3.bmp,SCREEN,40,1,XArr,YArr,NumFound
FindImagePos>%BMP_DIR%\image_4.bmp,SCREEN,40,1,XArr,YArr,NumFound
FindImagePos>%BMP_DIR%\image_5.bmp,SCREEN,40,1,XArr,YArr,NumFound
FindImagePos>%BMP_DIR%\image_6.bmp,SCREEN,40,1,XArr,YArr,NumFound
If>NumFound>0
  PlayWav>C:\Users\Music\disconnect_x.wav
  wait>1
Endif
ab.png

Image detection dont work with .png files so i cant remove the background to make the macro search only the "swords".

It detecting 50% of time, but like i said, if the background or zoom change too much it fails, how can i improve the detection?

math22
Newbie
Posts: 12
Joined: Sun Dec 03, 2017 1:00 am

Re: Increase image detection

Post by math22 » Wed Dec 13, 2017 4:19 am

Try change the value to 0.7 and use CCOEFF.

ruanseb
Newbie
Posts: 5
Joined: Fri Dec 01, 2017 9:37 pm

Re: Increase image detection

Post by ruanseb » Wed Dec 13, 2017 11:52 am

Hi i already tried with it, i'm trying increase the chance to find a image when the background are different

Code: Select all

//Find
FindImagePos>%BMP_DIR%\image_3.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
FindImagePos>%BMP_DIR%\image_4.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
FindImagePos>%BMP_DIR%\image_5.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
FindImagePos>%BMP_DIR%\image_6.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  PlayWav>C:\Users\Music\disconnect_x.wav
  wait>1
Endif

User avatar
JRL
Automation Wizard
Posts: 3497
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Increase image detection

Post by JRL » Wed Dec 13, 2017 1:39 pm

Sometimes less is more. Try capturing a needle image that does not include any background but is still unique, perhaps where the swords cross or at the hilt of one.

To increase the chances for capturing a zoomed image I think you may need a series of needle images at different zoom levels.

MadQuestion
Pro Scripter
Posts: 70
Joined: Wed Nov 08, 2017 6:54 pm

Re: Increase image detection

Post by MadQuestion » Sat Dec 30, 2017 2:36 am

Maybe try using a list of images of various zooms and backgrounds and then comparing that with a screen shot image of the area of the screen that the sword icons appear. Unless the location of the images is also randomised, then perhaps try screen capturing various screen areas and then compare bitmaps and if it is over the % threshold then say it has found the image... Might work... I usually just lower the threshold and use a needle image as JRL mentioned earlier.

ABIVEN
Pro Scripter
Posts: 71
Joined: Sun Aug 07, 2005 7:22 pm
Location: PARIS

Re: Increase image detection

Post by ABIVEN » Fri Jan 05, 2018 7:01 am

.
This thread highlights a needed precaution when you have to replace your monitor
Make sure to keep screen settings AD HOC
.

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