Image FindFailed on different MacBook-Pros even though the screen resolutions are the same

Asked by Lee Yen Liang on 2018-03-21

I have two MacBook-Pros. Both machines' resolutions are 2560 x 1600.

Each machine runs sikuli to do some tasks on an Android emulator(Nox App Player) whose resolution is set to 720 x 1280.

I just captured an image with sikuli on the old MacBook-Pro. Then I transfer the code along with the image to the new MacBook-Pro with gitlab. Then I run exactly the same code and the same image on the new MacBook-Pro, and find that sikuli can't find the image on the new MacBook-Pro.

Why does this happen?

The two images on the old and the new MacBook-Pros have exactly the same pixels.

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-03-21
Last reply:
2018-03-22
RaiMan (raimund-hocke) said : #1

I guess the problem is with the Android emulator, which produces differences on the both Macs.

To verify, make a screenshots on both machines of the offending region and compare with Mac Preview enlarging it so you can see individual pixels.

Another option is, to use the SikuliX IDE Preview.

Lee Yen Liang (lyl007) said : #2

I can't see much difference between the images captured on different MacBook-Pros.

I discovered that the new MacBook-Pro is able to find the image using `Pattern("icon.png").similar(0.5)` command.

Another thing I found interesting is that the old MacBook-Pro's display is `Intel Iris Graphics 6100 1536 MB`, and the new MacBook-Pro's display is `Intel Iris Graphics 540 1536 MB`. Maybe I should check the difference between the two displays.

Lee Yen Liang (lyl007) said : #3

`Pattern("icon.png").similar(0.5)` lowers the matching criteria.

RaiMan (raimund-hocke) said : #4

situations like that usually come from that the image has too much background towards the edges of the image and the background in another environment is slightly different.

The solution: concentrate the image on the key visual aspects and have as little background as possible towards the edges.

Lee Yen Liang (lyl007) said : #5

With the help of the online photo editor (`https://pixlr.com/editor/`), I found that the colors are slightly different between the image captured on the old MacBook-Pro and the image captured on the new MacBook-Pro.

You can compare the two images here( https://ibb.co/ktG9hx).

I think this is a problem that is really hard to deal with. New MacBook-Pro's color is a little bit brighter than the old MacBook-Pro.

Lee Yen Liang (lyl007) said : #6

Maby I have to find a way to set the colors of the screen to exactly the same on the two computers.

RaiMan (raimund-hocke) said : #7

This surely has nothing to do with colors.

If you look at both images and count pixels:
only just looking at the left slider:
- old 9 Pixels
- new 10 Pixels

this simply looks like different rendering omg both machines.

... and differences like this dramatically reduce similarity score.

Can you help with this problem?

Provide an answer of your own, or ask Lee Yen Liang for more information if necessary.

To post a message you must log in.