O'Reilly logo

Android Application Programming with OpenCV 3 by Joseph Howse

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Modifying ImageDetectionFilter for 3D tracking

For 3D tracking, ImageDetectionFilter needs all the same member variables as before, except the mSceneCorners variable. We also need several new variables to store computations about the target's pose. Moreover, the class needs to implement the ARFilter interface. Let's modify ImageDetectionFilter as follows:

public class ImageDetectionFilter implements ARFilter {

  // ...

  // The reference image's corner coordinates, in 3D, in real
  // units.
  private final MatOfPoint3f mReferenceCorners3D =
    new MatOfPoint3f();
  // Good corner coordinates detected in the scene, in // pixels.
  private final MatOfPoint2f mSceneCorners2D =
    new MatOfPoint2f(); // Distortion coefficients of the camera's lens. // Assume no distortion. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required