XOR image differences for webcam 'movie'
Posted: 2019-05-29T02:22:15-07:00
Hi,
I'm curious to create a 'difference' between 2 images that can be applied to turn one into the other. I believe XOR should do this (?) and so "composite -compose difference" should do the trick (?)
In particular I'm curious whether such differences can be JPEG compressed and used to update a webcam server a bit more efficiently than just sending regular JPEGs - kind of like a rudimentary MPEG perhaps.
It seems to get almost there, but leaves a 'halo' around image elements which spoils the effect. Also some 'ghost' effects. I tried creating these simple example PNGs
Image1
Image2 - just moved down-right a little
difference (XOR)
Image1 XOR difference -> should be Image 2 ? But get artifacts.
Commands used -
I've tried using -quality 100 in case that helps too. Any suggestions appreciated 
If I've got the wrong end of the stick somewhere, just let me know too
Cheers!
I'm curious to create a 'difference' between 2 images that can be applied to turn one into the other. I believe XOR should do this (?) and so "composite -compose difference" should do the trick (?)
In particular I'm curious whether such differences can be JPEG compressed and used to update a webcam server a bit more efficiently than just sending regular JPEGs - kind of like a rudimentary MPEG perhaps.
It seems to get almost there, but leaves a 'halo' around image elements which spoils the effect. Also some 'ghost' effects. I tried creating these simple example PNGs
Image1
Image2 - just moved down-right a little
difference (XOR)
Image1 XOR difference -> should be Image 2 ? But get artifacts.Commands used -
Code: Select all
composite 1.png 2.png -compose difference 3.png
composite 1.png 3.png -compose difference 4.png
If I've got the wrong end of the stick somewhere, just let me know too


Photo 1 - compressed with mozjpeg -quality 40 -tune-ms-ssim
High Quality XOR of photo 1 and 2
XOR JPEG compressed with mozjpeg ms-ssim -quality 40
Re-created image for photo 2 using JPEG XOR