How to find rectangle of difference between two images

.net, algorithm, c#, comparison, image

Solution

I don't think there is an easier way.

In fact doing this will just be a (very) few lines of code, so unless you find a library that does that for you directly you won't find a shorter way.

Problem

I have two images the same size. What is the best way to find the rectangle in which they differ. Obviously I could go through the image 4 times in different directions, but i'm wondering if there's an easier way. Example:

Original source