Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wish: 95% Hausdorff distance in vcgMetro() #37

Open
dwoll opened this issue Nov 5, 2022 · 4 comments
Open

Wish: 95% Hausdorff distance in vcgMetro() #37

dwoll opened this issue Nov 5, 2022 · 4 comments

Comments

@dwoll
Copy link

dwoll commented Nov 5, 2022

Again, thanks for developing Rvcg! While vcgMetro() provides relevant distance-based similarity metrics, I think that the 95% Hausdorff distance is currently not returned. As this metric is increasingly used, would it be possible to return it as well in the ForwardSampling and BackwardSampling components of vcgMetro()?

Thanks in advance for considering!

@zarquon42b
Copy link
Owner

Hi,
I am not sure what seems to be the issue. You can obtain the max/mean/RMS Haussdorfdistance both ways like (just switch ForwardSampling to BackwardSampling to get the reverse values):

samp$ForwardSampling$maxdist
samp$ForwardSampling$meandist
samp$ForwardSampling$RMSdist

@dwoll
Copy link
Author

dwoll commented Nov 7, 2022

Right, these are the classical HD metrics. Some people argue that the 95% HD is also relevant. It is basically the HD for the best-matching part of the structures ("Partial HD" called by Huttenlocher 1993: https://people.eecs.berkeley.edu/~malik/cs294/Huttenlocher93.pdf), ignoring 5% of the vertices with the longest distance. My C++ is weak, but calculating it in Rvcg should be doable. If the SamplingFlags::HIST is set, alls dists are stored:

hist.Add((float)fabs(dist));

The 95% HD would be the 0.95 quantile of the stored dists, and could be returned by a public interface like mean_dist.
Many thanks in advance!

@zarquon42b
Copy link
Owner

Hi,
the dists are included and you can compute the 95%-Quantile as
quantile(samp$distances1,probs=.95)

@zarquon42b
Copy link
Owner

This only applies for cases without sampling.
When doing edge/face sampling, the function does not store the dists but only tracks cumulatively. E.g. for computing mean_dist, all values are summed up and it divided by the number of samples afterwards (same for RMS).
See here:

Rvcg/src/metroSampling.h

Lines 251 to 255 in 2468255

if(dist > max_dist)
max_dist = dist; // L_inf
mean_dist += dist; // L_1
RMS_dist += dist*dist; // L_2
n_total_samples++;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants