I need to run comparisons on the output of hundreds of frames of simple 3D-rendered characters. Perceptually, many of the frames are exact duplicates. Based on this, I assumed something like a perceptual hash and comparison using pHash would work great. And in some cases it does...
However, I'm noticing that it doesn't tolerate minor (read: practically impossible for the human eye to see) color or contrast variations. Because of the nature of the rendered frames I received, there are some frames that are apparently different enough for pHash to conclusively decide that they are not the exact same.
Here are two example images along with a difference image:
pHash gives me a 0.473464% deviation between these images.
All those variations are enough to throw off pHash. Actually, pHash is able to tell that they are very similar, but I need a consistent low threshold to use for programmatic comparison. Other frames which actually deviate a tiny bit are sometimes considered more similar than the example above, even though they have perceptual differences. Which means I can't rely on pHash alone.
Here are two frames that are actually different (notice that his hands have moved a tiny bit):
Yet pHash gives me a difference percentage of 0.0188496%, which is less than 0.473464% from above, meaning that the frames that are perceptually different are actually considered more similar according to pHash.
I tried scaling and blurring the images a good bit to reduce any color variations, but I ended up having to do a ton of blurring to get closer. I don't want to do this too much, because I do want significant color changes to be considered as a unique frame.
For example, if there is a flash of light that illuminates the character, even if his character model is rendered in the exact same position, those frames should be considered unique:
Next, I tried Canny edge detection. This worked okay. Two problematic frames that are, for all intents and purposes, precise duplicates exhibited less differences:
The only issue I have with this method is that it only considers edges, which normally would be sufficient. If the character model changes at all, different edges should be detected. But this pretty much ignores significant color changes as mentioned above.
So my question is what is the best way for me to compare images like this and effectively counter insignificant color/contrast/noise variations? Seemingly pHash is ideal because of its perceptual nature, but I'm uncertain what I need to do as far as preprocessing to guarantee consistency from pHash (or some other algorithm, if it's better).