Giter VIP home page Giter VIP logo

simple_pose_estimation's Introduction

Pose Estimation

This is a toy example about how the pose of a camera is estimated.

Overview

In Computer Vision, the pose of an object typically refers to its relative orientation and position with respect to a camera. One can change the pose of an object by either moving the object with respect to the camera, or the camera with respect to the object. The pose of the object is typically estimated by analyzing the correspondences between features extracted from different images -- more than one image looking at the same scene from different angles.

  • 2D-to-2D: See [Hartley and Zisserman, 2000] for the projective transformation/homography and [Nister, 2004] as a seminal work on the visual odometry.
  • 3D-to-3D: See [Maimone et al., 2007] as an example of such a case.
  • 3D-to-2D: As pointed out [Nister, 2004], motion estimation from 3D-to-2D correspondences is more accurate than from 3D-to-3D cases because it minimizes the image reprojection error instead of dealing with 3D-to-3D feature position error. The sample codes in this repo is about a solution to the problem of the PnP (Perspective-n-Points). Some well-known PnP solutions are P3P [Gao et al., 2003], EPnP [Lepetit et al., 2009].

Reference

Requirements

To make it run, you need

  • OpenCV ver 3.0 or above
  • CMake ver 2.8 or above

To enable cv::viz, the VTK package in your OpenCV codes, the following has to be done: Install VTK and Recompile OpenCV. If you already installed the VTK and OpenCV properly, and don't have any issues in calling any built-in functions of cv::viz package, you don't need to do the followings.

  1. Install VTK (Visualization Toolkit):
    1. Download VTK 7.7.1 **Note** I've tried to do this with VTK 8.1, but it didn't work. So the following steps only work with VTK 7.7.1 and OpenCV 3.1.0 or 3.3.0.
    2. Unzip VTK-7.1.1.zip
    3. At the directory unzipped VTK-7.1.1, type `ccmake .` This will pop up cmake GUI. At the menu, do the following:
      BUILD_SHARED_LIBS = ON
      BUILD_TESTING = ON
      CMAKE_BUILD_TYPE = Release

      Then press c to save the current configuration and exit. You'll have to push c at the beginning to see any of these.

    4. At the directory unzipped VTK-7.1.1, do the following:
      cmake .
      make
      sudo make install
    5. Once you're done with all the above steps, you have VTK shared libraries and their friends installed on your local machine. Now move on to the next part, "Re-Compile OpenCV."
  2. Re-Compile OpenCV
    1. Download OpenCV 3.3.0 and unzip it.
    2. At the directory unziped OpenCV, do the following:
      mkdir build
      
      cd build
      
      cmake -D CMAKE_BUILD_TYPE=RELEASE -D CMAKE_INSTALL_PREFIX=/usr/local -D BUILD_PYTHON_SUPPORT=ON -D BUILD_EXAMPLES=ON โ€“D WITH_VTK=ON ..
      
      make
      
      sudo make install

Build

Now you have all the required libraries. It's time to build the repo. To build, do the following at the directory you cloned this repo:

mkdir build
cd build
cmake ..
make

Run the Executable

After compilation, in the build directly, type the following:

cd build
./pe

Results

Input Image

Output Image

simple_pose_estimation's People

Contributors

iagents avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.