I changed a different size monitor , the pics cannot be recognized

Asked by Rita

First I write the cases on my laptop, for now I move the cases on my computer, the monitor size is bigger than the laptop screen, so the pics cannot be recognized now, all cases cannot be run, so How to solve this problem, I need to get all new screenshot?

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

the captured pictures have to be the same pixel-by-pixel on both systems. So what counts is resolution and not screen size. In many situations (especially laptop widescreen and standard ration desktop monitor) you have interpolated pixels, that make that pictures look similar or identical, but on the pixel level they are different.

To test your situation, capture an object on both screens an have a look at them magnified, so you can compare the pixels visually.

Currently Sikuli has no feature to manage this situation, so you have to take 2 different image sets.

Revision history for this message
surfdork (surfdork) said :
#2

Verify your PPI (DPI) settings are the same on both systems. Also focus on capturing unique geometric primitives, especially as a test between both systems

If these are windows systems the following .vbs script will return in a message box the current PPI setting,this will spare a continual menu safari to get PPI settings on test systems

Const HKEY_CURRENT_USER = &H80000001
strComputer = "."
strKeyPath = "Control Panel\Desktop\WindowMetrics"
strEntryName ="AppliedDPI"
Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _
    strComputer & "\root\default:StdRegProv")
objReg.GetDwordValue HKEY_CURRENT_USER, strKeyPath, strEntryName, strValue
Wscript.Echo strValue, "DPI"

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

The following solution can be integrated a bit easier into a Sikuli script, because you do not need an extra .vbs script file.

It uses the reg command.

import os
regKey = r"HKCU\Control Panel\Desktop\WindowMetrics"
regField = "AppliedDPI"
cmd = 'reg QUERY "%s" /v %s'%(regKey, regField)
result= os.popen(cmd).readlines()
print eval(result[-2].strip().split()[-1]), "DPI"

The last statement builds on the knowledge, how the output of the reg command looks like, and prints the DPI as decimal value.

Can you help with this problem?

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

To post a message you must log in.