首页 > 解决方案 > OpenCV 透视变换(无标记 AR)

问题描述

我目前正在将用 C++ 编写的无标记 AR 源代码翻译成 C#,但不知何故,我的输出总是偏离应有的重点。下图是我的输出:

在此处输入图像描述

红色圆圈应该是正确的目的地,但我得到了黑色圆圈。所以我想知道这里是否有人对可能导致此问题的原因有任何建议。

我不擅长用文字描述,所以我试着用这张图来描述:

在此处输入图像描述

视频实例: https
://www.youtube.com/watch?v=3MaKHf3AIUU&feature=youtu.be 在此视频中:

我将代码上传到 GitHub: https ://github.com/abc225313/MarkerLessDetector

  1. 设置标记和训练

    PatternDetector.cstrain(Pattern pattern)
    PatternDetector.csbuildPatternFromImage(Mat image, Pattern pattern)

  2. main函数内输入图像

  3. 特征提取

    PatternDetector.csbool extractFeatures (Mat image,ref KeyPoint[] keypoints, ref Mat descriptors)

  4. 特征匹配

    PatternDetector.csvoid getMatches (Mat queryDescriptors, ref DMatch[] matches)

  5. 查找单应性

    PatternDetector.cs→ 内static bool refineMatchesWithHomography

  6. 包装

    PatternDetector.cs→ 可以在里面找到findPattern()

  7. 计算单应性

    PatternDetector.cs → calculated in function 查找模式()`

  8. 透视变换

    PatternDetector.cs→ 内static bool refineMatchesWithHomography

标签: opencv

解决方案


推荐阅读