-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGubberBlump.py
executable file
·68 lines (58 loc) · 1.89 KB
/
GubberBlump.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
from time import sleep
from BobberSeeker import BobberSeeker
from PIL import ImageGrab
import random
import json
import cv2 as cv
threshold = 0.65
fish_key = '1'
# load our templates from the json file
templateData = {}
with open('TemplateConfig.json') as json_file:
templateData = json.load(json_file)
while True:
seeking_bobber = True
seeker = BobberSeeker()
# sleep before looking
sleep_time = random.randint(1,4)
print('Sleep Time: ' + str(sleep_time))
sleep(sleep_time)
# take a screenshot
screenshot = ImageGrab.grab(bbox=(0,0,1920,1080))
screenshot.save("sreengrab.jpg")
img = cv.imread("sreengrab.jpg",0)
img2 = img.copy()
# TODO: break this out into json file and load/loop over the templates and thresholds
# brown water
print("brown water")
if seeking_bobber:
template = cv.imread('Templates/brown_water.JPG', 0)
bobber_found = seeker.FindBobber(img2, template, threshold)
if bobber_found:
print("We got it!")
seeking_bobber = False
print("blue water")
# blue water
if seeking_bobber:
template = cv.imread('Templates/blue_water.JPG',0)
bobber_found = seeker.FindBobber(img2, template, 0.50)
if bobber_found:
print("We got it!")
seeking_bobber = False
print("above")
# above
if seeking_bobber:
template = cv.imread('Templates/bobber_above.JPG',0)
bobber_found = seeker.FindBobber(img2, template, threshold)
if bobber_found:
print("We got it!")
seeking_bobber = False
# above with fish
print("above with fish")
if seeking_bobber:
template = cv.imread('Templates/bobber_above_fish.JPG',0)
bobber_found = seeker.FindBobber(img2, template, threshold)
if bobber_found:
print("We got it!")
seeking_bobber = False
sleep(1)