Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Calculate Hausdorff distance between two meshes

i am trying to find the deviation between two meshes. For e.g. the difference between two sets of points defined in 3d space, and i plan to visualise the distance using some 3d visualisation tool for e.g. QT3d or some open gl based library.

I have two sets of meshes, basically two .stl files. I have programmed to read them as inputs. Now I need to calculate the deviation between the corresponding meshes. For this, I understand that the Hausdorff distance is a possible mathematical tool. Is there any library which calculates the Hausdorff distance between two meshes?

i managed to find one piece of code. but its more or less a programm in itself. its called M.E.S.H. I dont want to use it as it is because, 1. its written in C, 2. I want to develop my own application (using a library of course).

The other questions asked on this forum are pointing towards the mathematical algorithm, I dont plan to implement the algorithm on my own.

I am using QT5 for programming with msvc2010(32 bit).

Best Regards

tdk.

like image 415
thedorkknight Avatar asked Dec 20 '22 09:12

thedorkknight


2 Answers

You can use igl::hausdorff in libigl. If your first mesh has vertices in the rows of a matrix VA with face indices FA and likewise VB and FB for your second mesh, then

double d;
igl::hausdorff(VA,FA,VB,FB,d);

will compute the Hausdorff distance d between the two meshes.

like image 66
Alec Jacobson Avatar answered Dec 27 '22 02:12

Alec Jacobson


It does not seem so complex to implement: http://vcg.isti.cnr.it/publications/papers/metro.pdf

like image 33
abenci Avatar answered Dec 27 '22 03:12

abenci