Skip to content

Commit d5ccfaf

Browse files
djkapnerfcollman
authored andcommitted
Vectorize tps 2.0 (#133)
* capitalizing className * 40% time saving from russel with sqeuclidean
1 parent 05719f1 commit d5ccfaf

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

renderapi/transform/leaf/thin_plate_spline.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,9 @@ def apply(self, points):
9999
def computeDeformationContribution(self, points):
100100
disp = scipy.spatial.distance.cdist(
101101
points,
102-
self.srcPts.transpose())
103-
disp = np.power(disp, 2.0) * np.ma.log(disp).filled(0.0)
102+
self.srcPts.transpose(),
103+
metric='sqeuclidean')
104+
disp *= np.ma.log(np.sqrt(disp)).filled(0.0)
104105
return disp.dot(self.dMtxDat.transpose())
105106

106107
def gradient_descent(

0 commit comments

Comments
 (0)