*, whose paper has been cited more than 500 times . While Metro is still a small open source standalone command line program available at our web site, its functionality have been integrated into MeshLab in the filter*

**Metro***Sampling->Hausdorff Distance*, and they can be used in a variety of ways.

So here is a short basic tutorial.

Start with a mesh (in the following the well known Stanford Happy Buddha (1087716 triangles). Aggressively simplify it in a significant way to just 50k tris (e.g. 1/20 of the original size). Reload the original mesh as a new layer. At this point you should have two approximation of the same shape well aligned in the same space. Toggling the visibility on and off of each mesh you should easily see the difference between the two meshes (tip:

*ctrl+click*over the eye icon in the

*layers*window turn off all the other layers).

Now you are ready to start the Hausdorff distance filter. First of all remember that the Hausdorff Distance between two meshes is a the maximum between the two so-called one-sided Hausdorff distances (technically not they are not a distance):

These two measures are not symmetric (e.g. the results depends on what mesh you set as X or Y).

In the Hausdorff filters MeshLab computes only the one-sided version

leaving the task of getting the maximum of the two to the user.

Now on the practical side. MeshLab uses a sampling approach to compute the above formula taking a bunch of points over a mesh

*X*and searching for each

*x*the closest point

*y*on a mesh

*Y*. That means that the result is strongly affected on how many points do you take over X and there are a lot of option on for that. A common very simple approach is just to use the vertexes of the highest density mesh as sampling points (e.g. the original Buddha vertexes): to do this simply leave checked only the "

*vertex sampling*" option in the filter dialog and be sure that the number of samples is greater or equal than the vertex number. After a few secs the filter ends writing down in the layers log windows the collected info. Something like:

: Hausdorff Distance computed

: Sample 543652

: min : 0.000000 max 0.001862

: mean : 0.000029 RMS : 0.000083

: Values w.r.t. BBox Diag (0.229031)

: min : 0.000000 max 0.008128

: mean : 0.000126 RMS : 0.000361

For sake of human readability the filter reports the values in the mesh units (whatever they are) and with respect to the diagonal of the bounding box of the mesh that is something you are always able to understand without knowing anything about the model units. For example in this case you can see that the maximum error between the two mesh is approximately 1% of the bbox diag, but on the average the two meshes are almost in the 1/10000 range.

The filter save in the all-purpose

*quality*field of the vertexes of the sampled mesh the computed distance values. To better visualize the error you can simply convert these values (for the high resolution mesh) into colors using the

*Color->Colorize by quality*filter that maps them in to a rather red-green-blue colormap. Usually given the non uniform distribution of the values you have to play a bit with the filter parameters clamping the mapping range to something meaningful (only a few points have the maximum so with a linear mapping of the values over the whole range will result into a almost uniform red mesh. Note that it is a red-green-blu map, so red is min and blue is max, so in our case red means zero error (good) and blue high error (bad).

The next image sequence report just a small detail of the one of the points with higher error. During the simplification we removed some

*topological noise,*(the thin tubes connecting the two side of the hole) from a Hausdorff point of view it is a rather large error: the points in the middle of the thin tubes has nothing in the simplified mesh that is close to them; so they bring up the maximum error significantly. Luckily enough they represent only a small portion of the whole mesh so the average error remains low.

Note that if you measure the other one-sided Hausdorff distance, that specific mesh portion will not denote any particular error, because in that case you sample the simplified mesh and for each point of the simplified mesh there are points of the original mesh that are quite close to them. In other words, in this case the simplified mesh is

*close*to the original one, but the original one is

*not close*to the simplified one.

Next post will discuss some remaining issues including the sampling of the surface, looking at all the taken samples and the found closest points and how to colorize the low resolution mesh...

Second part of the tutorial

**here.**
## 19 comments:

hi, this is useful. But I still do not know to to get a color map for the Hausdorf distances between two meshes. Can you give a list of operations like 1) File->open 2) File->open as a new layer 3)...

Thank you very much !!!

In summary the operations are:

1) Load two meshes as layers

2) Sampling->Hausdorff Distance: checking only the "sample vertexes" option. You get the result in the log window

3) Color->Colorize by Quality, Adjust the range to get the interesting values well mapped in the red-green-blue colormap

Let me know for what part of the above you need more info.

Cheers

P.

Hey there, great stuff this MeshLab! I just found out about it, it seems pretty nice. Any idea when the next post will be? Because I'd be quite interested to know how to colorise the low resolution mesh as well. Color->Colorize by Quality does not work in that case.

Hi

Which one represent Hausdorff distance? max, min, RMS or mean?

@Esfahlan

By definition, the Hausdorff distance is the one-sided max of the min distance. However in practice the mean or RMS measures are quite useful (much less sensible to outliers).

Cheers

P.

Hi, very useful, but for me it is also the direction of difference, I have negative and positive distances (before and after image) - in some parts Mesh 1 protrudes beyond Mesh 2, and in others it is behind. Is there a way to get at that rather than pure 'distance'? I guess this might mean defining a direction?

Hi, I have two meshes that are not very similar to compare. They are reconstructed from the point cloud of a wooden boat. I try to see the difference of the boat over time, since wood is sensitive and would transform due to the environment... Anyway, I aligned and used the Hausdorff distance filter with my meshes, but the result seems not right. The filter report says no point is sampled from the mesh.

What should I do with this condition? Or is it because these two meshes are too different (seems not)?

Hi!

How can I display a scale showing the differences between the distances?

Thanks in advance!

Dear Aurore,

if you mean how to show up the color-map scale, you may go Edit -> Quality Mapper. There you can find a range of choices.

Since this description is a little outdated, i took the time to do a in detail procedure for computing the Housdorff Dist. in Meshlab V1.3.3

Since i am not an expert in MeshLab you are welcome to suggest better ways. It seems rather complicated to me!

1)load or generate the two meshes. (Let's say A and B, where B is the mesh you want colored).

2)right click on B in the Layer Dialog (Ctrl-L if invisible) and select "Define new Per Vertex Attribute"

choose a name (e.g "Quality") and choose "q" as the Function.

3)Make sure that B is selected in the Layer Dialog

3)Compute the Hausdorff Distance (Filters: Sampling->Hausdorff Distance) With Sampled Mesh = B and Target Mesh = A

4)repeat 3) and Click the colored Rabit (or Edit:QualityMapperDialog) and Click Apply

5)Make A invisible (click the eye in the Layer Dialog)

Cheerz M

Hi,

Is there a way I can know the positive and negative mesh surface differencse rather than absolute differences?

Thank you in advance.

Dalia

Can anyone provide command to compare two mashes ?

Thanks

I saw that error percentage was calculated. Can anyone elaborate as to what parameters were used to do that?

Were the rms , mean , min and max values used for it?

Could you give the formula for this?

I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.

Matlab Training in Chennai

I am expecting more interesting topics from you. And this was nice content and definitely it will be useful for many people.

Matlab Training in Chennai

You have already made my day. By submitting this post you do me a fever. There are some post I have seen but not like this. You have submit the article with some good image. I have a blog with full of post in this category. You all can visit my blog. paper comparison checker.

Thank you for taking the time and sharing this information with us. It was indeed very helpful and insightful while being straight forward and to the point.

mcdonaldsgutscheine.net/ | startlr.com/ | saludlimpia.com/

This information is impressive..I am inspired with your post writing style & how continuously you describe this topic. After reading your post,thanks for taking the time to discuss this, I feel happy about it and I love learning more about this topic Excellent article.

AngularJS Training Institute in Chennai

AngularJS Cetification Training in Chennai

AWS Training in Chennai

AWS Devops Training in Chennai

DevOps Certification in Chennai

DevOPs Certification Training Institute in Chennai

Best AngularJS Training in Chennai

AngularJS Training in Chennai

Post a Comment