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

[Question] Error minimizer using weight and normal #474

Open
maximecharriere opened this issue Nov 3, 2021 · 1 comment
Open

[Question] Error minimizer using weight and normal #474

maximecharriere opened this issue Nov 3, 2021 · 1 comment

Comments

@maximecharriere
Copy link
Contributor

Hello,
I have a question about the use and operation of the algorithm used in libpointmatcher.

Context

  • I have a 3D model of a face mask
  • I have a 3D scan of a head

I need to adjust the position of the mask on the face, and return a global matching rate with information like where will the mask leak and where will the mask hurt.
I know how to calculate the error of the matching between my mask and my face, when they are at a given position. I now want to find the optimal transformation matrix to minimize this error.

I could simply use the ICP algorithm to find the best match, but the problem is that my error does not only depend on the squared distance between the two, but depends on the normal and some weights.

As we can see in this drawing where we only consider the squared distance, a situation where the mask does not touch the face (a leak appear) will have the same squared distance as if the mask goes into the face. We cannot therefore differentiate between these two situations.
image

However, a leak may be much more problematic and we look for the position of the mask where there is the least amount of leakage. Therefore, a different weight must be given to each situation.

To do this I do an orthogonal projection of the point of the mask onto the normal of the face.
image
This way, I also have the information whether the mask point is inside or outside the face.

Some calculations give me the relation between this distance and the error of this pair of points.
image

Issue

I really like how the libpointmatcher library is stuctured and the fact that it has an interface with CGAL. I already use it in my project to match the mask and the face with the GenericDescriptorOutlierFilter and the PointToPointErrorMinimizer. I just need to evolve my project now, taking into account the information from the normal as explained above.

I should be able to minimise my error by, for example, doing a gradient descent by changing the position of my mask.

Question

Would the libpointmatcher ErrorMinimizer be able to find the transformation matrix that minimizes my error, even though it does not depend on the squared distance ? If not, do you have any ideas on how to find this transformation matrix? Do you know of any algorithms or publications that could help me?

@pomerlef
Copy link
Collaborator

That's an interesting problem. For now, the library doesn't support asymmetric cost function out of the box. By looking at your problem statement, I suggest you to have a look at signed distances.

Don't hesitate to create a PR if you implement something functional. I'm interested too!

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