siavashk / pycpd

Pure Numpy Implementation of the Coherent Point Drift Algorithm
MIT License
510 stars 115 forks source link

Some questions. #83

Closed Harry710887048 closed 1 year ago

Harry710887048 commented 1 year ago

If I have two sets of points, one set is the feature points on another set of points, and the number of feature points is less than the target set, how should I adjust the parameters? It seems that it cannot match the target set well. Also, is the number of iterations fixed or can it be controlled when iterating to a certain degree? I look forward to your answer!

gattia commented 1 year ago

The number of points in the two clouds doesn't matter, and the algorithm doesn't find "matching" points. It just finds the best way to align the two sets of points overall.

When you say that it doesn't match the target well - do you mean that the overall point clouds arent close, or individual points? If the issue is the individual points and you want point matching, I usually use one as template, and then see where its points "land" after registration. Then, I use the original location of those points, and the new location of those points after registration to have perfect 1:1 matching.

You typically want to run the algorithm until it converges, otherwise you might not have an optimal alignment. The number of iterations is usually just a sanity check that after a certain number of iterations it "Should" have converged- otherwise you might want check something else/debug it.

hope that helps.

apurvazaveri commented 1 year ago

How about in case of constrained_deformable? I understand that the given correspondence acts as matching points. And if so does it try to bring the corresponding points from source as close as possible to target of does it bring it exactly to the target?

gattia commented 1 year ago

@Harry710887048 - I assume your answer is closed so I am going to close this issue.

@apurvazaveri, @agporto can maybe help clarify the point about correspondences as he implemented that portion of the code. However, I do not believe this should be a hard constraint, and instead of just additional information to help in the registration process. If you have more questions about the constrained registration, please open another Issue.

agporto commented 1 year ago

@apurvazaveri @gattia parameter e_alpha regulates the confidence in the priors. You can use it to make it a hard or a soft constraint. Please see: https://github.com/siavashk/pycpd/blob/e5ca02d2501fb4b633c1664de939c336ffa2349e/pycpd/constrained_deformable_registration.py#L19

gattia commented 1 year ago

Thank you!

apurvazaveri commented 1 year ago

Thanks that helps!