It's a good question. I do not have a real answer but this is too long for a comment.
First, I'll assume that you want a probabilistic test to determine if a new submission is likely a slightly modified version of an older one. Let's say you are comparing just two. You probably don't need to test all frames of one against all frames of the other. I would suspect that comparing the first, middle, and last of one against all frames of the other would be more than sufficient. Could do this both ways just for extra assurance. Or throw in a few random comparisons as well. So the cost is O(k*(n+m))
where one has n
frames, the other m
, and the cost for a single comparison is k
. (There is a bigger issue, though, which is that you have a growing collection to compare against. I'll say a bit about that later.)
So how to compare frames? I will assume they all have the same size. If not you will need to find a way to "normalize" to get equal dimensions. If there are color issues it might suffice to convert to gray scale. You then want a measure of discrepancy. An "obvious" one is to subtract one from the other and see if differences are small. This has a few of problems. One is that is much is white space, most differences will be zero without this meaning there is similarity. Another is that the relative darknesses might be different. A third is that one type of modification is to translate the main part of the picture (where the action is, so to speak). Worse I guess is that it could also be rotated. A fourth is that light/dark might get reversed.
For darkness issues, you might try either binarizing, or maybe averaging the nonwhite part and using that to normalize level of darkness for a given frame. To handle the possibility of color reversal you might first decide based on an overall value whether to first reverse via image negation.
For white space and translating/rotating, you might try the following.
(1) Find the weighted "centroid" and subtract that from all image values.
(2) Take the SingularValueDecomposition.
(3) Use the principle axis information to determine rotation angle. Now rotate so that
the new principal directions are vertical and horizontal.
At this point you might have images that can be compared by subtraction or perhaps division (with special handling needed for those values that are zero, say the background). If doing division what you would be looking for is some level of constancy outside of the background parts.
One possible shortcut above is if the two pairs singular values are "very" different from one another, that might indicate that the images are different. Again though, since there are ways to fool with coloring and brightness, you might want to conside cases where their ratios are roughly constant as being similar even if the actual values are quite different e.g. {2,1}
vs. {1,.5}
or even {.98,.53}
might be regarded as close enough to warrant the harder processing with rotations and all.
--- edit 2 ---
The paragraph above was partly blather. Here is how to salvage the idea. An m x m
matrix will have m
singular values, not 2. So the idea would be to throw away all but the largest few (five, say), and see if those have, approximately, a common ratio.
There might be a plausible way to extend this to the entire sequence defining the animation. You now have a rank 3 object rather than a matrix, but possibly flattening in one dimension would provide something workable. For this I'd suggest the flattening to be spacial, so each is m^2 x kj
where images are m x n
and the jth animation has kj
images (obviously this does not require that image lengths = widths, that's just to simplify exposition). Now you have very large matrices, e.g. if m=256
then 65536 x 999, say. But you can still extract the several largest singular values. If these have an approximately common ration then the animations might be related, and if not then maybe they are unrelated. I should emphasize that this is speculative, and you'd need to expermient on some cases to decide if the idea actually works.
--- end edit 2 ---
As for the problem of a growing library, this is somewhat ameliorated by the fact that you only have to compare newcomers with existing ones. But as that latter set grows this of course could become tedious. I have to wonder if there might be a quick "these two are obviously different" test though that could speed things. Another thing to consider is the "sociology" of the site. It might become possible to have a whitelist of contributors known not to have abused by copying, and that would mean some percentage of incoming contributions would not require this testing.
I realize this is both somewhat complicated (especially if you are not familiar with SVD-type methods) and also devoid of actual code. Just thought it might provide a few ideas for getting started. I hope you find something workable.
--- edit ---
Here is something else you might consider. You could place a digital watermark in the contributions, a unique one for each. If done steganograpy-style, and sufficiently secure that it cannot readily be detected or erased, then this would give you a very quick test for copying: simply test new submissions for presence of one of the existing signatures.
--- end edit ---