findElementByImage fails on Apple M1

I am trying to find an Element by image using opencv4nodejs. This worked on the other mac machines we have, but on the new mac studio having apple chip this fails. I compared the image making a screenshot, and the actual image is exactly the same as the expected one.

Has anyone faced this issue? Can anyone help please?

Details:
Using Android Emulator, Nexus_10_API_29
macOS Monteray
Appium Version: 1.22.3

Actually no any opencv feature worked for me on emulator. The images have slight difference every time.

Have you tried moving the problematic image to another working computer? If it gives error again I believe it is the configuration of this new device changing the image somehow.

not an expert in that area but had some experience with it. If I remember correctly I managed to use it with a M1 computer.
Make sure that the screenshot is a native device screenshot meaning, you took it using the device itself and not a Mac screenshot (whole PC screen) that you cropped afterwards.
I would guess (if you say that it worked) that it is an image scaling/size issue, maybe with the new Mac, the default Simulator/Emulator device size is a bit bigger or smaller than before…
Look at the options you can provide and play with them a bit: http://appium.io/docs/en/advanced-concepts/image-elements/
if you said it worked then try to adjust: ‘imageMatchThreshold’ option.
or try to take a new screenshot on the new M1 and use it, then you may get more info regarding your problem.

It works on other computers

I tried also native screenshots. Tried also to run on real device and with different imageMatchThreshold values, with different settings. But since no any opencv feature works, I suppose there is more an installation issue . However my appium-doctor can recongnize the opencv4nodejs module, and the errors show that comparison failed rather than module couldn’t found.

try to take a native screenshot and crop it on the M1 computer and then test it with different values.
another idea to locate the source of the issue is to lower down the threadHold to 0 and see if it finds anything at all (note that it will probably won’t find your desired image) get the element and print its coordinates for example. then’ you’ll know if the problem is with the image or installation.

Yeah I did all those tests, and also compared pictures with online comparison services and got the same picture.

At the end gave up with Opencv and chose perceptual hash comparison .