refactor digging
This commit is contained in:
@@ -16,6 +16,9 @@ def run():
|
||||
# initialize the user-class
|
||||
config = UserConfigs()
|
||||
|
||||
# PLOT_TO_USE = "business"
|
||||
PLOT_TO_USE = "main_plot"
|
||||
|
||||
# initialize the StunWindowCapture class
|
||||
try:
|
||||
capture_window = WindowCapture(
|
||||
@@ -27,6 +30,9 @@ def run():
|
||||
# capture_window = cv.VideoCapture("snip_slam.mp4")
|
||||
video_mode = True
|
||||
|
||||
# plot_to_use = "business"
|
||||
plot_to_use = "main_plot"
|
||||
|
||||
# initialize the StunVision class
|
||||
vision_stun = Vision()
|
||||
# initialize the StunOverlay class
|
||||
@@ -49,8 +55,6 @@ def run():
|
||||
print("pausing")
|
||||
continue
|
||||
|
||||
|
||||
|
||||
if video_mode:
|
||||
break
|
||||
else:
|
||||
@@ -67,24 +71,25 @@ def run():
|
||||
# continue
|
||||
|
||||
needles = []
|
||||
#needles.append(cv.imread("wtf.jpg", cv.IMREAD_UNCHANGED))
|
||||
if PLOT_TO_USE == "business":
|
||||
needles.append(cv.imread("dig/Brown0.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("dig/1.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("dig/2.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("dig/3.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("dig/4.jpg", cv.IMREAD_UNCHANGED))
|
||||
#needles.append(cv.imread("H1.jpg", cv.IMREAD_UNCHANGED))
|
||||
#needles.append(cv.imread("H2.jpg", cv.IMREAD_UNCHANGED))
|
||||
#needles.append(cv.imread("H3.jpg", cv.IMREAD_UNCHANGED))
|
||||
#needles.append(cv.imread("H4.jpg", cv.IMREAD_UNCHANGED))
|
||||
# needles.append(cv.imread("D1.jpg", cv.IMREAD_UNCHANGED))
|
||||
# needles.append(cv.imread("D2.jpg", cv.IMREAD_UNCHANGED))
|
||||
# needles.append(cv.imread("D3.jpg", cv.IMREAD_UNCHANGED))
|
||||
# needles.append(cv.imread("D3.jpg", cv.IMREAD_UNCHANGED))
|
||||
# needles.append(cv.imread("D4.jpg", cv.IMREAD_UNCHANGED))
|
||||
# needles.append(cv.imread("D5.jpg", cv.IMREAD_UNCHANGED))
|
||||
# needles.append(cv.imread("D6.jpg", cv.IMREAD_UNCHANGED))
|
||||
# needles.append(cv.imread("D7.jpg", cv.IMREAD_UNCHANGED))
|
||||
else:
|
||||
needles.append(cv.imread("H1.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("H2.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("H3.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("H4.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("D1.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("D2.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("D3.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("D3.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("D4.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("D5.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("D6.jpg", cv.IMREAD_UNCHANGED))
|
||||
needles.append(cv.imread("D7.jpg", cv.IMREAD_UNCHANGED))
|
||||
|
||||
for needle in needles:
|
||||
# do object detection
|
||||
@@ -131,8 +136,10 @@ def run():
|
||||
pause = True
|
||||
break
|
||||
|
||||
if PLOT_TO_USE == "main_plot":
|
||||
screenshot = capture_window.get_screenshot()
|
||||
rectangles = vision_stun.find(screenshot, cv.imread("dig/ok_button.jpg", cv.IMREAD_UNCHANGED), 0.8, 1)
|
||||
rectangles = vision_stun.find(screenshot, cv.imread("dig/ok_button.jpg", cv.IMREAD_UNCHANGED), 0.8,
|
||||
1)
|
||||
# draw the detection results onto the original image
|
||||
output_image = vision_stun.draw_rectangles(screenshot, rectangles)
|
||||
if len(rectangles) == 1:
|
||||
@@ -153,6 +160,14 @@ def run():
|
||||
if keyboard.is_pressed('p') == True or pause == True:
|
||||
pause = True
|
||||
break
|
||||
if keyboard.is_pressed('p') == True or pause == True:
|
||||
pause = True
|
||||
break
|
||||
if keyboard.is_pressed('p') == True or pause == True:
|
||||
pause = True
|
||||
break
|
||||
|
||||
|
||||
|
||||
# debug the loop rate
|
||||
print('FPS {}'.format(1 / (time() - loop_time)))
|
||||
|
||||
Reference in New Issue
Block a user