Giter Club home page Giter Club logo

nesots's Introduction

Non Euclidean Sliced Optimal Transport Sampling

Source code of the article:

Genest, Baptiste, Nicolas Courty, and David Coeurjolly. "Non-Euclidean Sliced Optimal Transport Sampling", Computer Graphics Forum (Proceedings of Eurographics), April, 2024

Capture d’écran 2024-04-10 à 08 37 32

Here are the instructions to generate blue noise samples on the sphere and hyperbolic spaces in any dimensions or to sample meshes of genus 0 (see spherical sampling) or genus >= 2 (see local hyperbolic sampling)

Note that we use CLI11 to provide a clear command line API, you can use --help on any executable to see all available options.

Ref : https://github.com/CLIUtils/CLI11

Building (Linux/macOS)

We use CMake, hence the usual building commands are required

from root folder :

mkdir build 
cd build
cmake ..
make -j7

Visualization

If you want to see the effects of each parameter or simply to see the algorithm in action you can use the option :

--viz 

to enable visualization with polyscope : https://polyscope.run/

Blue Noise on the sphere or on the hyperbolic plane

To generate blue noise points on the sphere in dimension 3, a classical use-case would be

./spherical_bluenoise --dim 3 --sample_size 1000 --viz 

The process is the same for the hyperbolic case with the executable.

Note that you can sample any distribution by providing samples with the option --target_measure nu.pts

Spherical Mesh Sampling

CEPS Modification

We use CEPS (https://github.com/MarkGillespie/CEPS) to maps a genus zero mesh to the sphere, To generate and output the spherical mesh, you must replace the file CEPS/src/SphericalUniformization/SphericalUniformization.cpp by this_folder/SphericalUniformization.cpp before compiling and then launch :

CEPS_BUILD_FILE/bin/spherical_uniformize input_mesh.obj

to generate the mesh.

To then sample a mesh, use

./spherical_mesh_sampling --input_mesh ../data/spot.obj --sphere_mesh ../data/spherical-spot.obj --sample_size 1000

The command above would reproduce the top row of the figure 6.

Local Hyperbolic Mesh Sampling

./local_hyperbolic_mesh_sampling --input_mesh ../data/macaca.obj --sample_size 1000

The command above would reproduce the bottom row of the figure 6.

Visualizing results

./vizu_pc --input_mesh ../data/macaca.obj --input_points /tmp/out.pts

Projective Plane Sampling

The code here only illustrates visually its use but one could export points clouds in the same way as illustrated in the code of spherical_bluenoise.cpp for instance.

nesots's People

Contributors

baptiste-genest avatar dcoeurjo avatar soufianekhiat avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

nesots's Issues

[Minor] output file on Windows

When the output file is specify as:

std::string outfile = "/tmp/out.pts";

Windows do not create the folder. And when we create the folder tmp he do not output the file, we need to start with "./"

std::string outfile = "./tmp/out.pts";

I can modify by hand, it's not a big deal, but a use of std::filesystem may help the portability of the code.

vector subscript out of range

Testing on debug mode, compiled with Eigen3 only:

Debug Assertion Failed!

Program: build\Debug\spherical_bluenoise.exe
Line: 1904

Expression: vector subscript out of range

Reproduction: run spherical_bluenoise with default parameters (on debug mode).
Issue:
In:

std::tuple<ints, scalars, array_elements> cumulative_function_difference(const scalars &a, const scalars &b)

here:

for (;a[la] < C[i].value && la < a.size();la++){};

Issue:

a[la] // <-- a.size() == 2048 && la == 2048

Callstack:

Callstack:
 	spherical_bluenoise.exe!std::vector<double,std::allocator<double>>::operator[](const unsigned __int64 _Pos) Line 1903	C++
>	spherical_bluenoise.exe!cumulative_function_difference(const std::vector<double,std::allocator<double>> & a, const std::vector<double,std::allocator<double>> & b) Line 87	C++
 	spherical_bluenoise.exe!computeOptimalCut2(const std::vector<double,std::allocator<double>> & a, const std::vector<double,std::allocator<double>> & b) Line 127	C++
 	spherical_bluenoise.exe!NSphericalGeometry::computeOptimalCut(const std::vector<std::pair<int,double>,std::allocator<std::pair<int,double>>> & a, const std::vector<std::pair<int,double>,std::allocator<std::pair<int,double>>> & b, int p) Line 37	C++
 	spherical_bluenoise.exe!SlicedGeometry<Eigen::Matrix<double,-1,1,0,-1,1>,std::pair<Eigen::Matrix<double,-1,1,0,-1,1>,Eigen::Matrix<double,-1,1,0,-1,1>>,Eigen::Matrix<double,-1,1,0,-1,1>>::computeBalencedSWGradients(const std::vector<Eigen::Matrix<double,-1,1,0,-1,1>,std::allocator<Eigen::Matrix<double,-1,1,0,-1,1>>> & mu, const std::vector<Eigen::Matrix<double,-1,1,0,-1,1>,std::allocator<Eigen::Matrix<double,-1,1,0,-1,1>>> & nu, const std::pair<Eigen::Matrix<double,-1,1,0,-1,1>,Eigen::Matrix<double,-1,1,0,-1,1>> & gamma, double & cost) Line 133	C++
 	spherical_bluenoise.exe!SlicedGeometry<Eigen::Matrix<double,-1,1,0,-1,1>,std::pair<Eigen::Matrix<double,-1,1,0,-1,1>,Eigen::Matrix<double,-1,1,0,-1,1>>,Eigen::Matrix<double,-1,1,0,-1,1>>::computeOTSlice$omp$1() Line 183	C++
 	[External Code]	
 	spherical_bluenoise.exe!SlicedGeometry<Eigen::Matrix<double,-1,1,0,-1,1>,std::pair<Eigen::Matrix<double,-1,1,0,-1,1>,Eigen::Matrix<double,-1,1,0,-1,1>>,Eigen::Matrix<double,-1,1,0,-1,1>>::computeOTSlice(const std::vector<Eigen::Matrix<double,-1,1,0,-1,1>,std::allocator<Eigen::Matrix<double,-1,1,0,-1,1>>> & mu, const std::vector<Eigen::Matrix<double,-1,1,0,-1,1>,std::allocator<Eigen::Matrix<double,-1,1,0,-1,1>>> & nu, double epsilon, int nb_batches, bool useMedian, const std::function<double __cdecl(Eigen::Matrix<double,-1,1,0,-1,1> const &)> & step_functionnal) Line 178	C++
 	spherical_bluenoise.exe!iter() Line 40	C++
 	spherical_bluenoise.exe!main(int argc, char * * argv) Line 139	C++
 	[External Code]	

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.