OpenCV Perspective Transform (Markerless AR)

Viewed 181

I’m currently translating a Markerless AR source code written in C++ to C#, but somehow my outputs are always off the point it should be. Below picture is my output:

enter image description here

Red circles are supposed to be the correct destination, but instead I got the black circles. And so I’m wondering if anyone here have any suggestions on what might causing this problem.

I’m not good at describing in words, so I try and describe it in this diagram:

enter image description here

Video instance: https://www.youtube.com/watch?v=3MaKHf3AIUU&feature=youtu.be
In this video:

  • Left side image: Image shown are generated from Homography Matrix calculated in step 5 and step 6.
  • Right side image: Image shown are generated from Homography Matrix calculated in step 8.

I uploaded my code onto GitHub: https://github.com/abc225313/MarkerLessDetector

  1. Set marker and Train

    PatternDetector.cs → train(Pattern pattern)
    PatternDetector.cs → buildPatternFromImage(Mat image, Pattern pattern)

  2. Input image within main function

  3. Feature Extraction

    PatternDetector.cs → bool extractFeatures (Mat image,ref KeyPoint[] keypoints, ref Mat descriptors)

  4. Feature Matching

    PatternDetector.cs → void getMatches (Mat queryDescriptors, ref DMatch[] matches)

  5. Find Homography

    PatternDetector.cs → within static bool refineMatchesWithHomography

  6. Wrapping

    PatternDetector.cs → can be found within findPattern()

  7. Calculating Homography

    PatternDetector.cs → calculated in function findPattern()`

  8. PerspectiveTransform

    PatternDetector.cs → within static bool refineMatchesWithHomography

0 Answers
Related