用 Java 实现 SIFT

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/5234517/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-30 10:07:44  来源:igfitidea点击:

Implementing SIFT in Java

javaimagecomparisonsift

提问by Flynn

So I'm working on a simple Java app that allows a user to input an image as a query and have the app compare it against a database of images (which is basically no more than a directory of different images). I'm basically investigating several image similarity measurement techniques to find out which ones are appropriate for comparing pictures of cars.

所以我正在开发一个简单的 Java 应用程序,它允许用户输入图像作为查询,并让应用程序将其与图像数据库(基本上只是不同图像的目录)进行比较。我基本上是在研究几种图像相似性测量技术,以找出哪些技术适合比较汽车图片。

I've been doing some reading and apart from FFT/SSIM, I've read that the SIFT algorithm can yield very good results. However, as someone with only about a year's worth of basic Java experience, I'm honestly not sure if I'm a good enough programmer to be able to implement it. Hell, I'm still having trouble understanding the core concepts of the algorithm due to it's apparent complexity.

我一直在做一些阅读,除了 FFT/SSIM,我还了解到 SIFT 算法可以产生非常好的结果。然而,作为一个只有大约一年基本 Java 经验的人,老实说,我不确定我是否是一个足够好的程序员来实现它。见鬼,由于算法的复杂性,我仍然无法理解算法的核心概念。

So I'd like to ask those with much more experience than me. Is it even practical in the first place to implement SIFT for such purpose? Could I do it with the JDK alone (no other addons, if even possible)? How would I go about doing it?

所以想请教比我有经验的人。首先,为此目的实施 SIFT 是否可行?我可以单独使用 JDK(没有其他插件,如果可能的话)吗?我将如何去做?

Thanks in advance

提前致谢

回答by Albert Cardona

The Fiji image processing package, which extends ImageJ, has a wiki website with information on its SIFT plugin:

扩展 ImageJ 的斐济图像处理包有一个 wiki 网站,其中包含有关其 SIFT 插件的信息:

http://pacific.mpi-cbg.de/wiki/index.php/Feature_Extraction

http://pacific.mpi-cbg.de/wiki/index.php/Feature_Extraction

The source code of the SIFT implementation in java is available in the mpicbg.git repository:

java中SIFT实现的源代码可在mpicbg.git存储库中找到:

http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=mpicbg.git

http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=mpicbg.git

The library that includes the SIFT feature extraction and feature matching is the mpicbg.jar, under Fiji.app/jars/ folder when you download Fiji.

包含 SIFT 特征提取和特征匹配的库是 mpicbg.jar,在您下载 Fiji 时位于 Fiji.app/jars/ 文件夹下。

Fiji can be downloaded from here:

斐济可以从这里下载:

http://pacific.mpi-cbg.de/wiki/index.php/Downloads

http://pacific.mpi-cbg.de/wiki/index.php/Downloads

An example of usage of the SIFT plugin is the registration of consecutive slices in an electron microscopy stack. See this page:

SIFT 插件的一个使用示例是在电子显微镜堆栈中注册连续切片。请参阅此页面:

http://pacific.mpi-cbg.de/wiki/index.php/Register_Virtual_Stack_Slices

http://pacific.mpi-cbg.de/wiki/index.php/Register_Virtual_Stack_Slices

The source code will teach you how to use the library for SIFT feature extraction and for computing transformation models from sets of matching features:

源代码将教您如何使用该库进行 SIFT 特征提取和从匹配特征集计算转换模型:

http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/register_virtual_stack_slices/register_virtual_stack/Register_Virtual_Stack_MT.java;hb=HEAD

http://pacific.mpi-cbg.de/cgi-bin/gitweb.cgi?p=fiji.git;a=blob;f=src-plugins/register_virtual_stack_slices/register_virtual_stack/Register_Virtual_Stack_MT.java;hb=HEAD

回答by sdc

You might want to consider ImageJ - http://en.wikipedia.org/wiki/ImageJ

您可能需要考虑 ImageJ - http://en.wikipedia.org/wiki/ImageJ

There is a SIFT plugin for it.

有一个 SIFT 插件。

And check answers on stackoverflow here - Using SIFT for Augmented Reality

并在此处查看有关 stackoverflow 的答案 - Using SIFT for Augmented Reality

回答by SandaruMK

This tutorial in openimaj shows a step by step procedure on how to use SIFT from OpenImaj library.

openimaj 中的本教程展示了如何使用 OpenImaj 库中的 SIFT 的分步过程。

http://openimaj.org/tutorial/sift-and-feature-matching.html

http://openimaj.org/tutorial/sift-and-feature-matching.html

However, If you need to the java implementation, as the tutorial says,

但是,如果您需要 java 实现,如教程所说,

We'll use the difference-of-Gaussian feature detector which we describe with a SIFT descriptor. The features we find are described in a way which makes them invariant to size changes, rotation and position. These are quite powerful features and are used in a variety of tasks. The standard implementation of SIFT in OpenIMAJ can be found in the DoGSIFTEngine class:

我们将使用我们用 SIFT 描述符描述的高斯差分特征检测器。我们发现的特征的描述方式使它们不受尺寸变化、旋转和位置的影响。这些都是非常强大的功能,可用于各种任务。OpenIMAJ 中 SIFT 的标准实现可以在 DoGSIFTEngine 类中找到:

The API method reference for the "DoGSIFTEngine" can be found by going through the following link.

可以通过以下链接找到“DoGSIFTEngine”的 API 方法参考。

http://openimaj.org/apidocs/org/openimaj/image/feature/local/engine/DoGSIFTEngine.html

http://openimaj.org/apidocs/org/openimaj/image/feature/local/engine/DoGSIFTEngine.html

Here is the link to the full implementation

这是完整实现的链接

http://openimaj.org/apidocs/src-html/org/openimaj/image/feature/local/engine/DoGSIFTEngine.html

http://openimaj.org/apidocs/src-html/org/openimaj/image/feature/local/engine/DoGSIFTEngine.html