GithubHelp home page GithubHelp logo

jiafeimaochuanqi / coverage_axis Goto Github PK

View Code? Open in Web Editor NEW

This project forked from frank-zy-dou/coverage_axis

0.0 0.0 0.0 6.78 MB

Official code for the paper Coverage Axis: Inner Point Selection for 3D Shape Skeletonization, Eurographics 2022.

Home Page: https://frank-zy-dou.github.io/projects/CoverageAxis/index.html

Python 41.09% MATLAB 58.91%

coverage_axis's Introduction

Introduction

Official code for the paper Coverage Axis: Inner Point Selection for 3D Shape Skeletonization , Eurographics 2022.

Authors: Zhiyang Dou, Cheng Lin, Rui Xu, Lei Yang, Shiqing Xin, Taku Komura, Wenping Wang.

[Project Page][Paper][Code]

teasar In this paper, we present a simple yet effective formulation called Coverage Axis for 3D shape skeletonization. Inspired by the set cover problem, our key idea is to cover all the surface points using as few inside medial balls as possible. This formulation inherently induces a compact and expressive approximation of the Medial Axis Transform (MAT) of a given shape. Different from previous methods that rely on local approximation error, our method allows a global consideration of the overall shape structure, leading to an efficient high-level abstraction and superior robustness to noise. Another appealing aspect of our method is its capability to handle more generalized input such as point clouds and poor-quality meshes. Extensive comparisons and evaluations demonstrate the remarkable effectiveness of our method for generating compact and expressive skeletal representation to approximate the MAT.

Key Features

  • We provide Coverage Axis computation for both mesh and point cloud inputs; The point cloud can be unoriented -> check out our latest SIGGRAPH work here.
  • Operations are accelerated by GPU, e.g., computation of coverage matrix and winding number for a mesh.

Requirements

System requirements

  • Linux Ubuntu 20.04
  • Python 3.8
  • Nvidia GeForce RTX 3090 (GPU is used for acceleration)

Installation

conda env create -f ca.yml
conda activate CA
pip install -r requirements.txt

Usage

Mesh Input

The input mesh 01Ants-12.off is placed in the folder input. The mesh is normalized.

Specify the settings for Coverage Axis in Coverage_Axis_mesh.py

real_name = '01Ants-12'
surface_sample_num = 2000
dilation = 0.02
# inner_points = "voronoi"
inner_points = "random"
max_time_SCP = 100 # in second

Run

python Coverage_Axis_mesh.py

The outputs are placed in the folder output.

  • mesh_inner_points.obj contains the candidate inner points.
  • mesh.obj contains the input mesh.
  • mesh_samples_2000.obj contains the sampled surface points that are covered.
  • mesh_selected_inner_points.obj contains the selected inner points.

Picture

You may use randomly generated points inside the volume as inner candidate points by setting inner_points = "random" . Notably, we already generate a sample. If you choose to produce candidates by randomly sampling inside the shape, it can be a little time consuming. Then run

python Coverage_Axis_mesh.py

Point Cloud Input

We use Fast Winding Number for Inside-outside determination for point cloud inputs.

Please use the following commands for building the modified libigl at https://github.com/Frank-ZY-Dou/libigl_CA. Note that Eigen is needed for libigl; make sure you have installed it.

sudo apt-get install git
sudo apt-get install build-essential
sudo apt-get install cmake
sudo apt-get install libx11-dev
sudo apt-get install mesa-common-dev libgl1-mesa-dev libglu1-mesa-dev
sudo apt-get install libxrandr-dev
sudo apt-get install libxi-dev
sudo apt-get install libxmu-dev
sudo apt-get install libblas-dev
sudo apt-get install libxinerama-dev
sudo apt-get install libxcursor-dev
sudo apt install libeigen3-dev
sudo apt-get install libcgal-dev

git clone https://github.com/Frank-ZY-Dou/libigl_CA.git
cd libigl_CA/
mkdir build
cd build
cmake ../
make -j8

Once finished, an executable file FastWindingNumber_CA will be generated in the folder bin. You can run it by

cd bin
./FastWindingNumber_CA ../../../input/01Ants-12_mesh.off ../../../input/01Ants-12_pc.obj ../../../input/01Ants-12_pc_random.obj

A point cloud will be saved to 01Ants-12_pc.obj in the folder input. A randomly generated candidate skeletal points will be written to 01Ants-12_pc_random.obj under the folder input.

Then run

python Coverage_Axis_pc.py

The outputs are placed in the folder output.

  • pc_inner_points.obj contains the candidate inner points.
  • pc_samples.obj contains the points of the point cloud that is covered. SCP is an NP-hard problem; make sure the number of to-be-covered samples is not that large.
  • pc_selected_inner_points.obj contains the selected inner points.

Picture

Remark: We generate the point cloud inputs and inside candidates based on Fast Winding Number. The candidates are generated by randomly sampling inside the volume. Other sampling strategies, like Voronoi-based sampling, can also be used. The core code for sampling the point cloud and generating inside candidates are given in

./libigl_CA/tutorial/FastWindingNumber_CA/main.cpp

More Information

Solve Coverage Axis in MATLAB

update: The code in MATLAB can be found in ./MATLAB.

Run

Pole_Selection_offset

The results are written to ./MATLAB/outputs

You could check with output file like vis_MA_init01Ants-27_scale0.03.obj.

The original optimization is solved by MATLAB. In this repo, we solve SCP by Scipy in Python. I found the solver of MILP in scipy is a little unstable compared with the MATLAB one; please suggest if you have a more powerful solver or any idea for this. Thanks ;)

f =  ones(1,medial_num); 
A =  -D;
b =  -ones(boundary_num,1)*1;%here ,we fix p_i 
lb = zeros(medial_num,1);
ub = ones(medial_num,1);
iint = [1:medial_num];
tic;
[x,fval]=intlinprog(f,iint,A,b,[],[],lb,ub);
toc;
disp('min_number:');
disp(fval);

Citation

@inproceedings{dou2022coverage,
  title={Coverage Axis: Inner Point Selection for 3D Shape Skeletonization},
  author={Dou, Zhiyang and Lin, Cheng and Xu, Rui and Yang, Lei and Xin, Shiqing and Komura, Taku and Wang, Wenping},
  booktitle={Computer Graphics Forum},
  volume={41},
  number={2},
  pages={419--432},
  year={2022},
  organization={Wiley Online Library}
}

References

coverage_axis's People

Contributors

frank-zy-dou avatar xrvitd 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.