Thursday, October 24, 2013

Point clouds to mesh conversion

1. PointSet >  Subsampling - Montecarlo or Poisson
Samples: enter the number of points that you want to have in the end - usually the initial size is millions - you can see it at the bottom of the window in Vertices:

2. PointSet > Compute normals for point sets
Neighbour num: 20
Smooth iteration: 5

3. Surface Reconstruction > Poisson
Surface Reconstruction > Ball Pivoting worked for me

http://meshlabstuff.blogspot.se/2009/09/meshing-point-clouds.html

Wednesday, October 16, 2013

Pointcloud Streaming on Ubuntu

1. compile and run the server
./bin/pcl_openni_mobile_server -p 11111

as described here:
http://www.pointclouds.org/documentation/tutorials/mobile_streaming.php 


2. Download Android app
git clone https://github.com/PointCloudLibrary/mobile.git

3. Download Android SDK

android-ndk-r5b can be found here:

http://developer.android.com/sdk/ndk/index.html

Read its documentation, specifically the Standalone Toolchain.

Assumming you read the documentation, follow steps for creating a standalone
toolchain.
  export NDK=~/android-ndk-r5b
  $NDK/build/tools/make-standalone-toolchain.sh --platform=android-5 \
    --install-dir=$HOME/android-toolchain

android-sdk can be found here:
http://developer.android.com/sdk/index.html
Please install that, and add it to your path.
  ANDROID_SDK=~/android-sdk-linux_86
  export PATH=$ANDROID_SDK/tools:$ANDROID_SDK/platform-tools:$PATH
http://android-cmake.googlecode.com/hg/documentation.html

4. Download android-cmake
sudo apt-get install mercurial
hg clone https://code.google.com/p/android-cmake/

http://android-cmake.googlecode.com/hg/documentation.html

5. Install boost using android-cmake scripts

Introduction -------------

Let's build boost for android. Assuming you are using the alias trick for android-cmake: export ANDTOOLCHAIN=$ANDROID_CMAKE/toolchain/android.toolchain.cmake alias android-cmake='cmake -DCMAKE_TOOLCHAIN_FILE=$ANDTOOLCHAIN '

I. Build the native code ------------------------

cd android-cmake/common-libs/boost Pull down and patch the boost libraries for android. sh ./get_boost.sh mkdir build cd build android-cmake .. make To build with for targets other than armeabi-v7a, edit the cache. (cmake-gui,ccmake)

II. Use boost in your projects ----------------

See the hello-boost project under samples. find_package(Boost REQUIRED filesystem system) include_directories(${Boost_INCLUDE_DIRS}) add_library(my_target SHARED ${my_target_srcs}) target_link_libraries(my_target ${Boost_LIBRARIES})
http://android-cmake.googlecode.com/hg/docs/boost.html

Monday, September 30, 2013

Compiling Meshlab on Linux

I couldn't save a project in Meshlab, so I compiled it myself and fixed the bug. 
It turns out that the latest version of Meshlab doesnt have this bug since the commit 6114,
but it still had the problem with opening a PLY file.
 
So I downloaded version r6184. 
 
The instructions for compiling are here 
https://sourceforge.net/apps/mediawiki/meshlab/index.php?title=Compiling#Compiling 
Here's a short version
 

1. Download code into a meshlab top folder:

svn checkout svn://svn.code.sf.net/p/vcg/code/trunk/vcglib vcglib
svn checkout svn://svn.code.sf.net/p/meshlab/code/trunk/meshlab meshlab

2. Compile 

cd meshlab/src/external
qmake -recursive external.pro 
make
cd meshlab/src/
qmake -recursive meshlab_mini.pro  
make
This would give you a stripped down version of meshlab without the Align tool for example.. 
 

If you try to compile with meshlab_full.pro then you get the error:
In file included from filter_csg.cpp:29:0:
gmpfrac.h:5:20: fatal error: mpirxx.h: No such file or directory
compilation terminated.
make[1]: *** [filter_csg.o] Error 1


This error persists since 2011:
https://sourceforge.net/p/meshlab/bugs/274/
 
To solve it, you can comment the following lines causing errors during compilation
a) in the file >> meshlab/src/meshlabplugins/filter_csg/filter_csg.pro  
#linux-g++-64:INCLUDEPATH += ../../external/inc/linux-g++-64/mpir-2.4.0
#linux-g++-64:LIBS += ../../external/lib/linux-g++-64/libmpirxx.a ../../external/lib/linux-g++-64/libmpir.a
 
b) in the file meshlab/src/meshlab_full.pro comment several plugins that are incompatible>>
#                meshlabplugins/filter_texture \
#                meshlabplugins/filter_plymc \
 
but I solved one plugin edit_align because I needed it by adding the include
#include <unistd.h>
on line 60 of vcglib/wrap/ply/plystuff.h just like in this post:
http://sourceforge.net/p/meshlab/discussion/499533/thread/15551772/
 
and now you can 
cd meshlab/src/
qmake -recursive meshlab_full.pro  
make

 3. Bugfixing - Open PLY files

+using namespace std;
+
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
QLocale::setDefault(QLocale::C);
QCoreApplication::setOrganizationName("VCG");
QCoreApplication::setApplicationName("MeshLab");
+
+ std::setlocale(LC_NUMERIC, "C");

https://sourceforge.net/p/meshlab/bugs/238/

 4. Testing 

The other bugs like saving a project are already fixed
https://sourceforge.net/p/meshlab/bugs/264/