I recommend you to use EXPECT_MAT_NEAR macro like this: EXPECT_MAT_NEAR(img_jpg_progressive, img_jpg_normal, 0). It is OpenCV test module extension for GTest. It makes the same check but it writes differs element that useful for test fail debug.