[Python] SikuliX Fails to Detect Images After Resizing for resolution and DPI Scaling...

Discussão em 'Python' iniciado por Stack, Março 5, 2025.

  1. Stack

    Stack Membro Participativo

    I am working on an automated GUI test using SikuliX and Robot Framework, and I need SikuliX to detect elements on the screen even when the screen resolution or Windows DPI scaling changes.

    What I Did:

    • Captured reference images on a system with 1920x1080 resolution and 125% DPI scaling.
    • Wrote a Python script using OpenCV to dynamically detect the current screen resolution and DPI scaling.
    • Resized my reference images proportionally before running SikuliX, so that they match the current screen settings.

    To debug, I did the following:

    • Checked OpenCV Similarity: Used SSIM (Structural Similarity Index) to compare the original vs. resized images. Output: Image similarity: 1.00 (pixel-perfect identical).
    • Added screenshots through the robot framework test to verify what is sikuli "seeing" and the screenshot is identical to my screen (no glitching).
    • Added "Reset Roi" to make sure sikuli is looking at the whole screen.
    • Checked SikuliX Match Score:

    Ran this Robot Framework test:

    ${score} = Get Match Score ${mcu_selector}
    Log Match score for ${mcu_selector}: ${score}


    Output:

    Match score for mcu_selector.png: 0.0


    SikuliX still fails to detect the image! OpenCV says the images are identical, yet SikuliX returns 0.0 match score.

    Why is SikuliX Failing? Is there a better way to handle resolution and scaling changes in SikuliX?

    Thank you in advance, I would really use the help!

    Continue reading...

Compartilhe esta Página