3 ms·
I'm finding "gm compare" to be faster. $ time ./imgdiff cypress.png cypress.png Success! Images are equal. 3.22user 0.10system 0:00.50elap
by dheera 6y ago
I'm finding "gm compare" to be faster.
$ time ./imgdiff cypress.png cypress.png
Success! Images are equal.
3.22user 0.10system 0:00.50elapsed 661%CPU
(0avgtext+0avgdata 478524maxresident)k
0inputs+0outputs (0major+48339minor)pagefaults 0swaps
$ time gm compare -highlight-style assign -highlight-color purple -file diff.png cypress.png cypress.png
1.99user 0.21system 0:02.21elapsed 99%CPU
(0avgtext+0avgdata 874948maxresident)k
0inputs+5240outputs (0major+217173minor)pagefaults 0swaps
$ time gm compare -metric mse cypress.png cypress.png
Image Difference (MeanSquaredError):
Normalized Absolute
============ ==========
Red: 0.0000000000 0.0
Green: 0.0000000000 0.0
Blue: 0.0000000000 0.0
Opacity: 0.0000000000 0.0
Total: 0.0000000000 0.0
0.94user 0.14system 0:00.67elapsed 161%CPU
(0avgtext+0avgdata 585832maxresident)k
0inputs+0outputs (0major+144881minor)pagefaults 0swaps
- jihchi 6y agoWere you comparing two identical image? Could you try two different image?
- noahtallen 6y agoTo really see how these algorithms perform, you should compare the worst case for the algorithm. In order to see if a picture is identical, you’d have to loop through every single pixel, which is the worst case. But you can shortcut on the first pixel which is different, which I imagine happens pretty quickly on many generic pictures. So testing performance with two different images is probably not best for comparison.
- acdha 6y agoYou can only short-circuit if you’re returning a Boolean. If you need to do what these tools and return some metric for the degree of difference you still have to process both images in entirety.