Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions splinedist/infer.py
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,19 @@
coord = details['coord']


def center(pts):
c = [sum(pts[:,0])/len(pts),sum(pts[:,1])/len(pts)]
return np.array([[p[0]-c[0],p[1]-c[1]] for p in pts])

#translate the centroids of the objects to the origin
for i in range(len(coord)):
object_coefs = coord[i]
object_coefs = np.transpose(object_coefs, (1,0))
centroid = [sum(object_coefs[:,0])/len(object_coefs),sum(object_coefs[:,1])/len(object_coefs)]
object_coefs_translated = np.array([[p[0]-centroid[0],p[1]-centroid[1]] for p in object_coefs])
return object_coefs_translated



# %%
# def example(model, i, show_dist=True):
Expand Down