Count an image available on screen.

Asked by Garima Kumar

Hello team,
I have a scanerio where i have single image multiple times on a screen.
now i want to count for this image, that how many times this image is available.
please guide me how to proceed with this.

if possible provide me a sample code.

Regards
Garima

Question information

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

count = 0
try:
    matches = list(findAll(<<your image>>))
    count = len(matches)
except FindFailed:
    pass #nothing to do
print "found:", count

more info about the features of findAll see docs.

Revision history for this message
Garima Kumar (garima-bit-mca) said :
#2

Hello RaiMan,

Thanks a lot for your help.
It's working for me.

Regards
Garima

On Wed, Mar 26, 2014 at 11:41 PM, RaiMan <
<email address hidden>> wrote:

> Your question #246084 on Sikuli changed:
> https://answers.launchpad.net/sikuli/+question/246084
>
> Status: Open => Answered
>
> RaiMan proposed the following answer:
> count = 0
> try:
> matches = list(findAll(<<your image>>))
> count = len(matches)
> except FindFailed:
> pass #nothing to do
> print "found:", count
>
> more info about the features of findAll see docs.
>
> --
> If this answers your question, please go to the following page to let us
> know that it is solved:
> https://answers.launchpad.net/sikuli/+question/246084/+confirm?answer_id=0
>
> If you still need help, you can reply to this email or go to the
> following page to enter your feedback:
> https://answers.launchpad.net/sikuli/+question/246084
>
> You received this question notification because you asked the question.
>

Revision history for this message
Eugene S (shragovich) said :
#3

Hi,

If this answers your question, please consider marking it as "Solved".
It makes it easier to navigate the answers and finding which ones still need to be answered.

Thanks,
Eugene

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

He said it works - so we take it as solved ;-)