我想在 C# 中使用 sift 实现。
我找到了这个网站http://user.cs.tu-berlin.de/~nowozin/libsift/ 但我很困惑没有主程序或项目文件。我不明白如何在普通的 C# 控制台/窗口应用程序中使用它,以及 GK# 的规则是什么。
有人能给我一些有用的提示吗,或者有人知道 C# 中的另一种实现吗?
我想在 C# 中使用 sift 实现。
我找到了这个网站http://user.cs.tu-berlin.de/~nowozin/libsift/ 但我很困惑没有主程序或项目文件。我不明白如何在普通的 C# 控制台/窗口应用程序中使用它,以及 GK# 的规则是什么。
有人能给我一些有用的提示吗,或者有人知道 C# 中的另一种实现吗?
没有主程序,因为它显然是一个类库。使用您最喜欢的 IDE 创建一个项目并将源文件添加到其中,或者打开一个终端窗口并使用包含的 Makefile 构建库。
https://sites.google.com/site/btabibbian/projects/3d-reconstruction/code
您可以在此处找到一个具有 Sift 类的实现。它基于 EmguCV 库。sift_features(名称非常违反 C# 约定)返回一个具有 double[] 描述符成员的 Feature 对象列表。
此代码与 Surf 算法http://www.emgu.com/wiki/index.php/SURF_feature_detector_in_CSharp非常相似。
public Image<Bgr, Byte> PutFeaturesOnImage(string file)
{
Image<Gray, Byte> modelImage = new Image<Gray, byte>(file);
SIFTDetector siftCPU = new SIFTDetector();
VectorOfKeyPoint modelKeyPoints = new VectorOfKeyPoint();
MKeyPoint[] mKeyPoints = siftCPU.DetectKeyPoints(modelImage, null);
modelKeyPoints.Push(mKeyPoints);
ImageFeature<float>[] reulst = siftCPU.ComputeDescriptors(modelImage, null, mKeyPoints);
Image<Bgr, Byte> image = Features2DToolbox.DrawKeypoints(modelImage, modelKeyPoints, new Bgr(Color.Red), Features2DToolbox.KeypointDrawType.DEFAULT);
return image;
}
记得添加库:
using Emgu.CV;
using Emgu.CV.Features2D;
using Emgu.CV.Util;
using Emgu.CV.Structure;
using System.Drawing;
我比较了 EmguCv 和 OpenCV SIFT 算法。结果是一样的。在这两个示例中,功能的数量完全相同。
命名约定遵循 UBC 发布的原始 C 代码,因为它只是测试算法执行情况。如果您需要任何帮助,我将很乐意提供帮助。