Appium+OpenCV: Images differing only in color accept as equal

#opencv config
image.match.threshold=0.5
fix.image.template.size=true
fix.image.find.screenshot.dimensions=true

I have a game on android. I am trying to assert that the element is present. Element has 2 state: disabled (grey color of elements) and enabled (bright color)
Structure always the same but different color.
The code is the next

    public boolean isDisplayed() {
        log.debug("is displayed :: " + name);
        return waitForMobileElement().isDisplayed();
    }
    MobileElement waitForMobileElement() {
            return await().untilNotNull(() -> findElement().orElseThrow(),
                    String.format("Failed to find element '%s'", name));
    }

But when i run the test - it doesn’t matter which stage in fact: if I look for color one and gray in fact - accept.
If I set IMAGE_MATCH_THRESHOLD = 1 - see nothing

and where is the opencv related code ?

(the code you’re showing, is quite useless)

I use appium which trigger openCV

see, if the problem is about appium – we cannot help you (it’s quite off-topic)

if the problem is from opencv – we cannot help, without seing, what you do !

1 Like