Note that there are some explanatory texts on larger screens.

plurals
  1. PODetermine whether or not a smaller image is within a screenshot?
    primarykey
    data
    text
    <p>I've started making a bot in Python. The objective of the bot is to read simple one-digit numbers off the screen then add them together. At the moment I know how I would get the screenshot. I'm stuck on the image recognition. I've looked into OpenCV Template Matching.</p> <p>I've tried to get my head around how to do this for days. The only code I've been able to write is at the bottom of the question.</p> <p>For example what I'm trying to do is: (In order)</p> <ol> <li>It will grab a screenshot</li> <li>It will run through comparing my images of numbers to the screenshot</li> <li>Upon finding a matching image it will record a value to a variable.</li> <li>Then it will move on to the next number.</li> <li>It will repeat steps 1 - 3</li> <li>It will add the to numbers together.</li> </ol> <p>Currently this is what my code looks like:</p> <pre><code>import sys import cv2 import numpy from cv2 import cv import PIL from PIL import ImageGrab print("Authentication") print("Enter Password:") entered = raw_input() if entered == "hello": print("************Menu************") print("1: Quit") print("2: Start Bot") print("3: Settings") print("*" * 28) mode = input("") if mode == 1: print("Closing Answer Quick") import time time.sleep(3) quit elif mode == 2: import time print("Bot Initialize") time.sleep(1) print("Getting Screen") time.sleep(3) screenimage = ImageGrab.grab() x = [1, "images\1.png", "images\2.png", "images\3.png", "images\4.png", "images\5.png", "images\6.png", "images\7.png", "images\8.png", "images\9.png"] ##Here is where the screen recognition code goes elif mode == 3: print("Settings") else: import time print("Incorrect Password") time.sleep(3) quit </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload