diff --git a/combine_main.py b/combine_main.py index 2289294..0ed859a 100644 --- a/combine_main.py +++ b/combine_main.py @@ -83,7 +83,7 @@ def run(): #cv.waitKey(150) #continue - spawn_1 = vision_stun.find(screenshot, cv.imread("magic/spawn_1.jpg", cv.IMREAD_UNCHANGED), 0.5, 1) + spawn_1 = vision_stun.find(screenshot, cv.imread("magic/spawn_1.jpg", cv.IMREAD_UNCHANGED), 0.5, 1, True, cv.imread("magic/spawn_1-mask.png", cv.IMREAD_UNCHANGED)) if len(spawn_1) == 1: spawn_button_active = True points = vision_stun.get_click_points(spawn_1) @@ -121,7 +121,7 @@ def run(): cv.imshow("output_needle", processed_needle) cv.waitKey(150) - rectangles = vision_stun.find(processed_screenshot, processed_needle, 0.70, 2) + rectangles = vision_stun.find(processed_screenshot, processed_needle, 0.90, 2, True, None) # draw the detection results onto the original image #output_image = vision_stun.draw_rectangles(screenshot, rectangles) #cv.imshow("output_image", output_image) diff --git a/magic/spawn_0.jpg b/magic/spawn_0.jpg index 31fc3ae..eaed723 100644 Binary files a/magic/spawn_0.jpg and b/magic/spawn_0.jpg differ diff --git a/magic/spawn_1.jpg b/magic/spawn_1.jpg index dd7bdc2..f046bdf 100644 Binary files a/magic/spawn_1.jpg and b/magic/spawn_1.jpg differ diff --git a/readme.txt b/readme.txt new file mode 100644 index 0000000..ea0cc90 --- /dev/null +++ b/readme.txt @@ -0,0 +1,4 @@ +Strength 100 = x2 Mining Bonus +Endurance 100 = x2 Farming Bonus +Charisma 100 = x2 Equipment Bonus +Ethic 100 = x2 Crops Bonus \ No newline at end of file diff --git a/vision.py b/vision.py index 8d91a1a..cdaca19 100644 --- a/vision.py +++ b/vision.py @@ -92,13 +92,14 @@ class Vision: needle_w = needle_img.shape[1] needle_h = needle_img.shape[0] - if normalize: + if mask is not None: result = cv.matchTemplate(haystack_img, needle_img, cv.TM_CCORR_NORMED, None, mask) - _minVal, _maxVal, minLoc, maxLoc = cv.minMaxLoc(result, None) - cv.normalize(result, result, 0, 1, cv.NORM_MINMAX, -1) + #_minVal, _maxVal, minLoc, maxLoc = cv.minMaxLoc(result, None) else: result = cv.matchTemplate(haystack_img, needle_img, self.method) + if normalize: + cv.normalize(result, result, 0, 1, cv.NORM_MINMAX, -1) # Get the all the positions from the match result that exceed our threshold locations = np.where(result >= threshold) locations = list(zip(*locations[::-1]))