minor fixes

This commit is contained in:
2022-06-13 16:42:41 +02:00
parent 2930eb04b1
commit 5e25b8303f
5 changed files with 10 additions and 5 deletions

View File

@@ -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)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.4 KiB

After

Width:  |  Height:  |  Size: 2.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.2 KiB

After

Width:  |  Height:  |  Size: 3.1 KiB

4
readme.txt Normal file
View File

@@ -0,0 +1,4 @@
Strength 100 = x2 Mining Bonus
Endurance 100 = x2 Farming Bonus
Charisma 100 = x2 Equipment Bonus
Ethic 100 = x2 Crops Bonus

View File

@@ -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]))