<p>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.</p>
<p>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.</p>

CC BY-SA 4.0
2023-10-26T09:38:08.453Z
2023-10-26T09:38:08.453Z
NikoNyrh
<p>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.</p>
<p>I'm wondering if there are any models that can identify visual differences between two very similar images but is robust enough to ignore &quot;slight&quot; layout changes.</p>

<computer-vision>
Can computer vision identify visual discrepancies in images?
Robert W
# Can computer vision identify visual discrepancies in images?

(Asked by: username_0 on 2023-10-25)

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.

**Tags:** computer-vision


---

## 1 answers

### Answer by username_1 on 2023-10-26. Score: 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.


---

