I have the Android code for storing pictures in database. How can I compare a stored picture with a picture that is taken?
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There could be several right answers, depending on what you’re looking for.
If you’re talking about comparing a new photo made with the on-device camera, there’s virtually no chance it will be a byte-for-byte match with any existing file.
If you want to detect an exact match from a source where a copy is likely, look at the file size and dimensions of the two images. If they are exactly the same, then you can look at the bytes. To save time, store a digital signature (e.g., an MD5 or SHA1) hash of the contents in the database along with the image.
If you want to find whether the images are similar in appearance, then you’ll have to find some way to characterize the image. I’m no expert at this, but in my naive approach, I’d do something like divide the image into a fixed number of regions and measure the amount of red, green and blue in each region. You could even do this recursively on ever-smaller regions as approximate matches are found. Comparing whole images will be a lot easier than finding a partial match.