Just in case, if what you wanted is to get differences from consecutive camera input frames in order to detect movement or whatever, you'll need to take into account that, although 2 frames may 'look' the same, they will possibly have many differences in their pixel values due to noise and light changes. So, direct pixel comparison will not work in this case.
(Seen this later)
Inthis case all the mentioned loop methods will be ok. But I bet that
OpenCV should be fast enough specially for large images. There are Core functions to add, substract, and count non-zero values in a Mat which are really optimized.
Also, you'll possibly need a way to know which areas (i.e., the boundings) have changed (or have a number of changes above a given threshold) and when only local changes occur just send that sub-picture along with its coordinates. It will be more efficient than sending the whole picture again.