Skip to content

Commit

Permalink
Merge pull request #53 from joao-voltarelli/fix_images_path
Browse files Browse the repository at this point in the history
FIX: Updated handling for image path
  • Loading branch information
hhslepicka authored Apr 13, 2022
2 parents 31ca95a + d235e81 commit 22508aa
Showing 1 changed file with 7 additions and 1 deletion.
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

0 comments on commit 22508aa

Please sign in to comment.