def reproject_one_shape( self, shape, bbox, window, nfids):
'''Re-project a shape to the original plan.
'''
shape_re = shape
std_w, std_h = window
x = bbox[0]
y = bbox[1]
w = bbox[2]
h = bbox[3]
center_x = x + np.divide(w, 2)
center_y = y + np.divide(h, 2)
X = shape[0:nfids]
Y = shape[nfids:]
# reprojecting ...
X = X * (std_w / 2.) + center_x
Y = Y * (std_h / 2.) + center_y
shape_re = np.concatenate((X,Y))
return shape_re
评论列表
文章目录