Spotting difference in images

In this minimalistic demo (github.com/konvica/spot-img-diff), I demonstrated a simple method to localize differences between misaligned images. For example highlighting differences between screenshots of a webpage, which can be useful for Web UI Testing.

This simple method is based on Computer Vision techniques. The first step is image alignment, which is especially important for webpage screenshots due to scrolling up or down. I am using OpenCV Feature Matching to get coordinates of matching keypoints/regions between two images. From these coordinates I calculate homography transformation to align both images. Afterwards, a simple difference between images spots different pixels. Found differences can be clustered together simply by using theclosing operation. In the case of regions with text data, PyTesseract can be used to extract differences in text.

Written on June 20, 2021