Combine regions in imagecounting.

Asked by Leif

Hi!

I'm curious if sikuli could combine multiple regions and from there do a imagecount? I'm heavily relying on the imagecount feature and in order to optimize the script i would love to use regions in the imagecounting. The images that needs to be counted appears on many different locations making the region selection challenging.

With my imagecount command:
imageCount = len(list([x for x in Region(106,1755,2608,45).inside().findAll(Pattern("1464427130648.png").similar(0.92))]))

My question is: Could this imagecount only count within multiple small regions?

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

Are you talking about restricting your findAll() to some smaller regions instead of using the large region (106,1755,2608,45)?(which in fact is not that large ;-)

... or do you have more than one of these regions?

What do you want to optimize?

A Region is something, that you always have to define before searching inside:
- absolute (like you did)
- relative to some match, that you have found before (some logo, title bar, ...)

conclusion: not really clear, what you want to achieve.

BTW:
- already using the latest version (much faster): http://sikulix.com
- this is sufficient:
imageCount = len(list(Region(106,1755,2608,45).findAll(Pattern("1464427130648.png").similar(0.92))))
... because findAll already returns an iterable object sufficient for list()
... inside() is somewhat redundant

Revision history for this message
Leif (leifhaa) said :
#2

Well the idea is that it should count objects (title bars as you mention). I've structured the windows so the title bar only will appear in specific regions (up to 12 different regions). I'm thinking since i already know where the title bars are going to appear, there is no point in searching my whole screen in order to count them. Instead i suppose it would be more efficient to define many regions where they are going to spawn. I can not only use one region to define where they are going to spawn because it would make the region restriction pointless as the whole region would equal my whole screen.

So in a attempt to be more clear I want to restrict the search to multiple small regions defined (sort of spots all over the screen)

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

What system?

What version?

ok, understood.

Do the window titles have different textual content? (using App.window() to get the region of the window and hence the title bar)

Usually on all systems a window has some fixed frame elements (e.g. close/hide/min-max buttons). You can look for these on the whole screen and then evaluate the title regions from that match.

Surely there are other possibilities.

If you have no idea, you might send me a screenshot of the stacked window setup (sikulix--at--outlook--dot--com)

Revision history for this message
Leif (leifhaa) said :
#4

I'm currently using windows 10 together with sikuli 1.1.0

The window titles do have parts of equal content (enough to understand that It's the sort of app we're looking for) and parts on unequal content.

I'm sending a email now regarding the stacked window setup.

Can you help with this problem?

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

To post a message you must log in.