I have a set of a million images of people (between 1 and 15 megapixels each) . I want to detect when two images A and B from this set are (more or less similar) CROPS from the SAME bigger unknown image, that is, NOT in the set. In particular, A and B must be (more or less) IDENTICAL in a large rectangle (>75% of the area of A and B) contained in both, yet maybe they have different aspect ratios.
I am using for this PHASH, but it is not very precise…
Do you know a better algorithm for my purpose? Maybe I should try a further autocrop before hashing? Much better if it is already implemented in some library (OpenCV?)
For the first and second suggestions, those are probably too intensive? I need to compare hundreds of images with the set with one million, every day. With hashing, I already have a database with all hashes of the original set with one million images.
For the third, definitely not. The sources are long gone, and I cannot keep that amount of data for new additions.
Suppose there is an original unknown image, already lost (the one at the left). Then I have one crop of this image stored among a million of other images where I can compute hashes (the center one). Now, I have another image that is also a crop of the unknown one (the one at the right).
So: I want a fast and reliable algorithm to detect that the right image has a big common rectangle with the second one, among the million images I have. Or, equivalently, that the image at the right is also a crop from a bigger one.
Neither the second or the third are contained in the other, but they have a big common rectangle.
They are exact crops of the same photo, no rotation. But they may have different aspect ratios and they can also have been shrunk. That is, the crops must take into account translations and homotheties. I should have shrunk one of the two crops, forgot about the homotheties. So this is closer to what I need:
if it weren’t for the scaling, the problem could have been somewhat easier.
here’s some more in perceptual hashing (variants of hashes):
I really don’t enjoy problems where one has to recalculate information that once existed but was discarded, when it could have been kept. you don’t have to store the complete original image, but its name and the crop rectangle would have been useful. I won’t ask directly why that isn’t the case.