Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: Updated handling for image path #53

Merged
merged 1 commit into from
Apr 13, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
8 changes: 7 additions & 1 deletion botcity/web/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,7 @@ def _to_dict(lbs, elems):

results = [None] * len(labels)
paths = [self._search_image_file(la) for la in labels]
paths = [self._image_path_as_image(la) for la in paths]

if threshold:
# TODO: Figure out how we should do threshold
Expand Down Expand Up @@ -517,6 +518,7 @@ def find_until(self, label, x=None, y=None, width=None, height=None, *,
region = (x, y, w, h)

element_path = self._search_image_file(label)
element_path = self._image_path_as_image(element_path)

if threshold:
# TODO: Figure out how we should do threshold
Expand Down Expand Up @@ -620,6 +622,7 @@ def find_same(item, items):
region = (x, y, w, h)

element_path = self._search_image_file(label)
element_path = self._image_path_as_image(element_path)

if threshold:
# TODO: Figure out how we should do threshold
Expand Down Expand Up @@ -785,8 +788,11 @@ def get_element_coords(self, label, x=None, y=None, width=None, height=None, mat
if not best:
print('Warning: Ignoring best=False for now. It will be supported in the future.')

element_path = self._search_image_file(label)
element_path = self._image_path_as_image(element_path)
haystack = self.get_screen_image()
it = cv2find.locate_all_opencv(self.state.map_images[label], haystack_image=haystack,

it = cv2find.locate_all_opencv(element_path, haystack_image=haystack,
region=region, confidence=matching)
try:
ele = next(it)
Expand Down