counting icons

Asked by fani

Hello,

I want to count cross and checks in a screenshot like that:

There is a list with a 1 in there for a cross and a 0 for a check. For example. check,cross, cross, check - Output 0 1 1 0
Can I realise it with the class Finder?

How can I realise it?

Cheers.

Question information

Language:
English Edit question
Status:
Answered
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
RaiMan (raimund-hocke) said :
#1

could you post a screenshot somewhere in the net and post the link here.

Revision history for this message
fani (sagerer) said :
#2

This is the screenshot of the cross and check I want to count. It's not just important for me how many of each there are, also in which order.

http://dl.dropbox.com/u/40735765/Untitled.jpg

Cheers.

Revision history for this message
RaiMan (raimund-hocke) said :
#3

This is the principle based on your screenshot:

cross = "1348735556699.png"
check = "1348735653726.png"
#print selectRegion() # had to define the column region on my screen
reg = Region(0, 110, 40, 500)
# in real life, this should be defined relative to some key visual
reg.highlight(1)
crosses = sorted(list(reg.findAll(Pattern(cross).similar(0.95))), key= lambda m: m.y)
checks = sorted(list(reg.findAll(Pattern(check).similar(0.90))), key= lambda m: m.y)
for e in crosses: e.highlight(1)
for e in checks: e.highlight(1)

crosses and checks contain a sorted list of the corresponding matches.
Come back if you need more help.

Can you help with this problem?

Provide an answer of your own, or ask fani for more information if necessary.

To post a message you must log in.