Pictures are made of pixels (individual points with a color), so you need to extract every pixel of your first picture and compare it with the same pixel coordinates of the second. The difference of the color value can help you to decide. Often it makes sense to have a small allowed difference to avoid noise.
As I googled has matlab some functionality of making that hard work for you:
Mathlab example