Reputation: 11
Problem: I am working with presentation where I convert slide in to image. Now I have to check for duplicate slide image that is in same presentation or new upload presentation.
What I did: I save image in SQL Server Database with base 64 format and compare this images with new uploaded file.
Issue: when I uploaded same presentation at that time base 64 work properly, but if I check with different presentation with same slide it is not get same base 64 string. I've tried with byte[], but still get same issue.
Also I want to know that what is the bast format(base64,Byte[], or etc..) for image to store and check in SQL.
Thank you in Advance.
Upvotes: 0
Views: 432
Reputation: 36639
If you want exact image comparison it should simply be an issue of creating hashes using your favorite hash algorithm and comparing them. Either manually, or letting the database do its thing.
If you want to do approximate image comparison you will need to use a image hash. Such algorithms are available in Open CV and can be used in c# by with the emgu cv wrapper, or several other platforms. You might need to either do the hashing yourself or using python packages in SQL server as Panagiotis Kanavos mentions.
Images would typically be stored as binary blobs of compressed image files, but storing raw image data is also possible. But I would consider if storing images directly in the database is the best approach, in many cases using the file system is preferred. See storing images in databases for the full discussion.
Upvotes: 4