I have been reading a bit about it, but I am not some expert at coding, and I am starting to get a bit confused... so here I have some specific questions maybe someone can tell me. First let me explain the overall situation.
Overview:
I need to scan for image recognition, comparing AT LEAST 25 images, but later something around 40 images.
After the image is detected, there is no problem at all for the speed (I actually have to put in lots of "wait").
Preferably it will be looping detection (not totally necessary, but its gonna be far less accurate and hard to time for the application if it is not looping).
The image on the screen for it to compare to changes slightly every 0.1 seconds, but I find using tolerance of between .8 and .9 to always find it... if I go less, then it gets false positives.
The image it must match against must be recognized within 1-2 seconds. In theory, it could take slightly longer (maybe 4 or 5 seconds) but then I would have to somehow time the screenshot perfectly which would be difficult.
My computer is by no means slow, with a i7 2700k, however I would guess this program does not have multi-thread support anyway....?
I cannot really post the code so easily, because this macro with all the SRTs is about 3000 lines long already.
Questions:
If I reduce the size of the .mpb (resolution?) will the image still be detected at different proportions/resolutions? Will this speed up the detection at all?
If I scan a very specific part of the screen for the reference image, will this increase the speed?
How can I maximize the speed of a loop (there is and if/else statement for each image, it runs through this whole series, then re-detects all of the images, making a rather long loop).
Any other suggestions for increasing the speed? Right now its taking nearly 20 seconds, and I only have like 20ish images.
Optimizing image detection speed
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Optimizing image detection speed
Hi,
A lower resolution would be faster - less pixels to scan.
A smaller portion of the screen rather than the whole screen would be faster to scan - less pixels. You can use WINDOW: instead of SCREEN to scan just a window area rather than the whole screen.
EXACT match is faster because it is a simple pixel by pixel comparison not a statistical analysis.
Reducing FIP_SCANPIXELS when using EXACT match will make it faster - instead of scanning ALL pixels it will scan a random selection of pixels (you set how many). Obviously you risk false positives but depending on your situation/image/how you have captured it - it may make sense.
A lower resolution would be faster - less pixels to scan.
A smaller portion of the screen rather than the whole screen would be faster to scan - less pixels. You can use WINDOW: instead of SCREEN to scan just a window area rather than the whole screen.
EXACT match is faster because it is a simple pixel by pixel comparison not a statistical analysis.
Reducing FIP_SCANPIXELS when using EXACT match will make it faster - instead of scanning ALL pixels it will scan a random selection of pixels (you set how many). Obviously you risk false positives but depending on your situation/image/how you have captured it - it may make sense.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
-
- Newbie
- Posts: 5
- Joined: Fri Sep 16, 2016 11:55 am
Re: Optimizing image detection speed
thanks for the suggestions!