siavashk / pycpd

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

Main #87

Closed kylewang1999 closed 1 year ago

gattia commented 1 year ago

Hey, did you resolve the issue? Or is there something that you think needs to be addressed?

Thanks.

kylewang1999 commented 1 year ago

My apologies for the confusion. The pull request was intended for my personal forked copy of your repository, not your master repo. Despite that, I do have a question regarding the implementation.

I was trying to generalize the implementation of DeformableRegistration.update_transform() to accommodate a vector-valued sigma2, which allows each gmm centroid to have a different covariance value.

In the step where eq.22 in the original paper is solved for, I changed

 A = np.dot(np.diag(self.P1), self.G) + self.alpha * self.sigma2 * np.eye(self.M) 

to

A =  self.G @ np.diag(self.P1) + self.alpha * np.diag(self.sigma2)     

Do you think this is the correct generalization?

gattia commented 1 year ago

That looks like it would work great for that reason. The only comment is that it looks like you changed the order of the dot product (@) which would change that result.