Code Monkey home page Code Monkey logo

model-globally-match-locally-python's Introduction

Model Globally, Match Locally: Efficient and Robust 3D Object Recognition

Small python implementation of the paper "Model Globally, Match Locally: Efficient and Robust 3D Object Recognition" by Drost. et al (2010) [paper].

Use the --fast flag to use the binary extension (see instructions below)

Screenshots of a model and scene before matching and after matching with PPF-Voting.

Usage

$ python3 ppf.py --help                                                                                        
usage: ppf.py [-h] [--fast] [--scene-pts-fraction SCENE_PTS_FRACTION] [--ppf-num-angles PPF_NUM_ANGLES] [--ppf-rel-dist-step PPF_REL_DIST_STEP] [--alpha-num-angles ALPHA_NUM_ANGLES]
              [--cluster-max-angle CLUSTER_MAX_ANGLE]
              model scene

This script computes the point-pair features of a given
model and tries to find the model in a given scene.

Note: Currently, trimesh doesn't support pointcloud with normals. To combat this, you need to
      reconstruct some surface between the points (e.g. ball pivoting)

positional arguments:
  model                 Path to the model pointcloud
  scene                 Path to the scene pointcloud

options:
  -h, --help            show this help message and exit
  --fast                Use the c++ extension for speeeeeed
  --scene-pts-fraction SCENE_PTS_FRACTION
                        Fraction of scene points to use as reference
  --ppf-num-angles PPF_NUM_ANGLES
                        Number of angle steps used to discretize feature angles.
  --ppf-rel-dist-step PPF_REL_DIST_STEP
                        Discretization step of feature distances, relative to model diameter.
  --alpha-num-angles ALPHA_NUM_ANGLES
                        Number of angle steps used to discretize the rotation angle alpha.
  --cluster-max-angle CLUSTER_MAX_ANGLE
                        Maximal angle between poses after which they don't belong to same cluster anymore. [degrees]

Object Symmetry Extraction

Another neat thing you can do with PPF-Voting is figuring out object symmetries. You simply give the mesh of your model (or a resampled version of it) to ppf.py and it will figure out the rest. You'd probably want to combine it with ICP though.

Screenshot showing different symmetric poses of the same object.

Gotchas

  • This is very much an exploratory implementation to understand the paper. No guarantees for correctness, no speed.
  • As trimesh currently doesn't support point clouds with normals, input need to be meshes
  • Currently, the code does no resampling of the input meshes, so preprocess them
  • There are probably some mistakes still in the code, I discover more every now and then

C++ Extension via nanobind

To get much faster processing times, compile the binary extension. To do so, make sure you have Eigen installed on your system, a C++ compiler, CMake, etc. Then:

# to load nanobind and its dependencies
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make

Additionally, symlink the resulting .so to the main folder. Now you should be able to run ppf.py with the --fast option.

model-globally-match-locally-python's People

Contributors

whateverforever avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  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.