botcity-framework-core-python icon indicating copy to clipboard operation
botcity-framework-core-python copied to clipboard

find.all duplicate object

Open dimitriusssBR opened this issue 1 year ago • 0 comments

Describe the bug

find.all sometime returns duplicated objects on specific matching range find.all in version 0.4.0 find.all returns the list of objects by matchscore. In version 0.3.0 it was in the order they are found on the screen.

Box: x=1447, y=740, w=52, h=29, score=0.9999566078186035 Box: x=1102, y=740, w=52, h=29, score=0.967707633972168 Box: x=1620, y=740, w=52, h=29, score=0.9400887489318848 Box: x=1275, y=740, w=52, h=29, score=0.8545419573783875 Box: x=1274, y=740, w=52, h=29, score=0.846000075340271 Box: x=1533, y=641, w=52, h=29, score=0.82472825050354

objects 4 and 5 are the same

objects are shown in order of best score

Expected behavior Box: x=1447, y=740, w=52, h=29, score=0.9999566078186035 Box: x=1102, y=740, w=52, h=29, score=0.967707633972168 Box: x=1620, y=740, w=52, h=29, score=0.9400887489318848 Box: x=1275, y=740, w=52, h=29, score=0.8545419573783875 Box: x=1533, y=641, w=52, h=29, score=0.82472825050354

Steps to Reproduce

cv2find.py edited to print score:

print(f"Box: x={x}, y={y}, w={needle_width}, h={needle_height}, score={result[y]}") yield Box(x, y, needle_width, needle_height)

elements = self.find_all(label="arena_150", matching=0.81, waiting_time=1000, grayscale=False) elements_list = list(elements)

Possible Solution Fix duplicated entry

Please give find.all the option to list objects by score and also as it was in version 0.3.0 in the order they appeared on the screen (left-right-top-bottom)

for x, y in zip(matchx, matchy):
    yield Box(x, y, needle_width, needle_height)

My Platform

botcity-email-plugin 0.1.3 botcity-framework-base 0.4.3 botcity-framework-core 0.3.0+2.g54db502 botcity-framework-web 0.8.2 botcity-maestro-sdk 0.3.4 botcity-telegram-plugin 0.1.4

Additional context

Windows scale 100%, image scale 100% arena

needle / label / resource arena_150

dimitriusssBR avatar May 12 '24 11:05 dimitriusssBR