1

I have an automated visual regression test harness for my web app. It takes baseline and change snapshots using puppeteer and compares them using pixelmatch. If I change the height of an element on the screen however, it pushes everything else on the page down slightly and pixelmatch identifies it as a difference.

I'm wondering if there are any models that can identify visual differences between two very similar images but is robust enough to ignore "slight" layout changes.

Robert W
  • 111
  • 1

1 Answers1

1

The first idea to come to my mind, is to calculate the pixel-wise difference, and then pass it through a median filter of a suitable radius. But if your element's height changes significantly and it pushes everything down, then this will be seen as a significant change even after the median filtering.

If you want to ignore all differences due to constant shifting, you'll need to employ more complex algorithms. Then edit-distance and dynamic programming comes to my mind.

NikoNyrh
  • 767
  • 4
  • 8