OpenCV IOS real-time template matching

2019-01-23 22:29发布

问题:

I'd like to create an app (on iPhone) which does this:

I have a template image (a logo or any object) and I'd like to find that in camera view and put a layer on the place of where it is found and tracking it!

It is a markless AR with OpenCV!

I read some docs and books and Q&A-s here, but sadly

actually i'd like to create something like this or something like this.

If anyone can send to me some source code or a really useful tutorial (step by step) i'd really be happy!!!

Thank you!

回答1:

Implementing this is not trivial - it involves Augmented Reality combined with template matching and 3D rendering.

A rough outline:

  1. Use some sort of stable feature extraction to obtain features from the input video stream. (eg. see FAST in OpenCV).
  2. Combine these features and back-project to estimate the camera parameters and pose. (See Camera Calibration for a discussion, but note that these usually require calibration pattern such as a checkerboard.)
  3. Use template matching to scan the image for patches of your target image, then use the features and camera parameters to determine the pose of the object.
  4. Apply the camera and object transforms forward and render the replacement image into the scene.

Implementing all this will require much research and hard work!

There are a few articles on the web you might find useful:

  • Simple Augmented Reality for OpenCV
  • A minimal library for Augmented Reality
  • AR with NyartToolkit

You might like to investigate some of the AR libraries and frameworks available. Wikipedia has a good list:

  • AR Software

Notable is Qualcomm's toolkit, which is not FLOSS but appears highly capable.