C ++/SIFT/SQL-是否可以有效地比较图像的SIFT描述符和SQL数据库中的SIFT描述符? [英] C++/SIFT/SQL - If there a way to compare efficiently a SIFT descriptor of an image with a SIFT descriptor in a SQL database?
问题描述
我想找到一种方法,可以将图像(查询)的SIFT描述符与包含大量不同图片描述符的SQL数据库中的描述符进行比较.
I would like to find a way which would allow to compare a SIFT descriptor of an image (query) with descriptors in a SQL database which contains lots of descriptors of differents pictures.
实际上,我的最终目的是创建一个应用程序,该程序可以将一个图片与一个数据库(而不是我的设备中)但在一个SQL数据库中的很多图片进行比较.
In fact, my final purpose is to do an application which allow to compare one picture with lots of picture in a database (not in my device) but in a SQL database.
我想到的第一件事是将每个描述符存储在SQL数据库上,并使用蛮力方法或FlanneBased方法将每个描述符与另一个描述符进行比较.问题是,在SQL数据库中,由于匹配背后的数学"(例如,欧几里得距离为sqrt(a²+b²+ ...)),计算匹配要花费很长时间.在庞大的数据库中进行这种比较.
The first thing i thought was to stock each descriptors on the SQL database and compare each descriptors to another one using the Brute Force method or the FlanneBased method. The problem is that,in a SQL database, it would take a long time to compute a matching because of the "mathematics" behind the matching (Euclidean distance for example is sqrt(a²+b² +...) ) and it's not possible to do that kind of comparison in an huge database.
例如,如果我没有记错的话,SIFT描述符包含128个数字,那么想象一下将每个描述符的每个数字都比较在一起的时间.
For example a SIFT descriptor contains 128 numbers if i'm not mistaken so imagine the time comparing each number of each descriptors together.
如果还有另一种方法可以做到这一点?我知道在SQL数据库中,当您使用"SELECT a FROM b WHERE ..."之类的请求时,请求是有效的.
If there another way to do that stuff ? I know in a SQL database, requests are efficient when you use something like "SELECT a FROM b WHERE ..."
因此,我想知道是否存在一种有效存储SIFT描述符的方法?例如,我考虑过将描述符加密"成一条大的字符串链,并且每个链都是唯一的,因此我可以将它们进行比较,但我不知道这是否是一个好的解决方案.
Therefore i wonder if there is a way to stock SIFT descriptors in an efficiently way ? For example i thought about "to crypte" the descriptors into a kind of big string chain and each chain would be unique and therefore i could compare them together but i don't know if it's a good solution.
我已经阅读了这篇文章:比较存储在SIFT中的功能一个mysql数据库,但是对我没有帮助. 谢谢.
I've already read this post : Comparing SIFT features stored in a mysql database but it didn't help me. Thank you.
推荐答案
如果您是我,我宁愿比较代码中的描述符,而不是SQL中的描述符. SQL并非用于此目的.我将执行以下操作:-
If I were you, I would prefer comparing the descriptors in the code, rather than in SQL. SQL isn't meant for that. I would do the following:-
1. Pre-load N descriptors from SQL onto memory.
2. Compare distances to query descriptor, descriptor by descriptor.
3. If distance<threshold, push to possiblematches.
4. When you reach N/2 descriptors, push the next N.
5. Compare all matches, choose the best one or the best D descriptors, as per your requirement.
但是,为此,我宁愿使用OpenCV的内置FileStorage类,该类为XML和YAML文件提供I/O.它解决了手动解析描述符值的麻烦.
However, for this, I'd rather use OpenCV¡s inbuilt FileStorage class which provides I/O onto XML and YAML files; it solves the headache of manually parsing descriptor values.
这篇关于C ++/SIFT/SQL-是否可以有效地比较图像的SIFT描述符和SQL数据库中的SIFT描述符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!