Return the dimensions of an image that's just been found
So this is an example of the code I'm working with, the real code has twenty images, but I've simplified it to three.
mySimilarity = 0.86
count = 0
main_address = r"C:\Users\
while True:# Searching......at the 4th loop. LAST ADDED 13 04 2018
while (count < 10): # Reduce the Match by 9 percent.
if exists(
print('found 1st image at similarity %f') % mySimilarity
first_image_used = main_address + r"\first_
file = open(first_
current_
file.close()
new_
print('Number of times this image has been found %f') % new_current_
text = str(new_
f = open(first_
f.write(text)
f.flush()
f.close()
break
elif exists(
print('found 2nd image at similarity %f') % mySimilarity
second_
file = open(second_
current_
file.close()
new_
print('Number of times this image has been found %f') % new_current_
text = str(new_
f = open(second_
f.write(text)
f.flush()
f.close()
break
elif exists(
print('found 3rd image at similarity %f') % mySimilarity
third_image_used = main_address + r"\third_
file = open(third_
current_
file.close()
new_
print('Number of times this image has been found %f') % new_current_
text = str(new_
f = open(third_
f.write(text)
f.flush()
f.close()
break
else:
count = count + 1
mySimilarity = mySimilarity - 0.01 # reduce by 1%
print(
if count > 8:
print('none of the images found.')
popup('none of the images found.')
continue # retry from the beginning
break
When "none of the images found" is printed excessively I go looking for the corresponding text file with a zero in it, I replace the image, then start the program over from the beginning, all up that wastes about 10 minutes.
So I've discovered the screen capture feature, so I figure I can automate the process by having a new screenshot taken of images as they are found, but I'm not sure how to return the dimensions of a found image.
Once I know how to return the dimensions of a found image I can update the least recognized images.
Hope that made sense.
Question information
- Language:
- English Edit question
- Status:
- Solved
- For:
- SikuliX Edit question
- Assignee:
- No assignee Edit question
- Solved by:
- masuo
- Solved:
- Last query:
- Last reply: